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(const double theDx, const double theDy,
21 const double theDz) throw (GeomAlgoAPI_Exception)
23 GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz);
25 if (!aBoxAlgo.check()) {
26 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
31 if(!aBoxAlgo.isDone()) {
32 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
34 if (!aBoxAlgo.checkValid("Box builder with dimensions")) {
35 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
37 return aBoxAlgo.shape();
40 //=========================================================================================================
41 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
42 std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception)
44 GeomAlgoAPI_BoxPoints aBoxAlgo(theFirstPoint, theSecondPoint);
46 if (!aBoxAlgo.check()) {
47 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
52 if(!aBoxAlgo.isDone()) {
53 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
55 if (!aBoxAlgo.checkValid("Box builder with two points")) {
56 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
58 return aBoxAlgo.shape();