1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_ShapeAPI.cpp
4 // Created: 17 Mar 2016
5 // Author: Clarisse Genrault (CEA)
7 #include "GeomAlgoAPI_ShapeAPI.h"
8 #include <GeomAlgoAPI_Box.h>
9 #include <GeomAlgoAPI_BoxPoints.h>
11 #include <GeomAPI_Pnt.h>
12 #include <GeomAPI_Edge.h>
13 #include <GeomAlgoAPI_EdgeBuilder.h>
17 namespace GeomAlgoAPI_ShapeAPI
19 //=======================================================================================
20 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
21 const double theDx, const double theDy,
22 const double theDz) throw (GeomAlgoAPI_Exception)
24 GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz);
26 if (!aBoxAlgo.check()) {
27 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
32 if(!aBoxAlgo.isDone()) {
33 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
35 if (!aBoxAlgo.checkValid("Box builder with dimensions")) {
36 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
38 return aBoxAlgo.shape();
41 //======================================================================================
42 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
43 std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
44 std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception)
46 GeomAlgoAPI_BoxPoints aBoxAlgo(theFirstPoint, theSecondPoint);
48 if (!aBoxAlgo.check()) {
49 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
54 if(!aBoxAlgo.isDone()) {
55 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
57 if (!aBoxAlgo.checkValid("Box builder with two points")) {
58 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
60 return aBoxAlgo.shape();