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>
10 #include <GeomAPI_Pnt.h>
11 #include <GeomAPI_Edge.h>
12 #include <GeomAlgoAPI_EdgeBuilder.h>
16 namespace GeomAlgoAPI_ShapeAPI
18 //=======================================================================================
19 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
20 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(
42 std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
43 std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception)
45 GeomAlgoAPI_Box aBoxAlgo(theFirstPoint, theSecondPoint);
47 if (!aBoxAlgo.check()) {
48 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
53 if(!aBoxAlgo.isDone()) {
54 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
56 if (!aBoxAlgo.checkValid("Box builder with two points")) {
57 throw GeomAlgoAPI_Exception(aBoxAlgo.getError());
59 return aBoxAlgo.shape();