1 // Name : ModelHighAPI_Services.cpp
5 // 17/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Services.h"
9 //--------------------------------------------------------------------------------------
10 #include <GeomAPI_Ax3.h>
11 #include <GeomAPI_Pnt.h>
12 #include <ModelAPI_Session.h>
14 //--------------------------------------------------------------------------------------
15 std::shared_ptr<ModelAPI_Document> moduleDocument()
17 return ModelAPI_Session::get()->moduleDocument();
20 //--------------------------------------------------------------------------------------
21 std::shared_ptr<ModelAPI_Document> activeDocument()
23 return ModelAPI_Session::get()->activeDocument();
26 //--------------------------------------------------------------------------------------
27 std::shared_ptr<GeomAPI_Ax3> defaultPlane( const std::string& theName )
29 std::shared_ptr<GeomAPI_Pnt> o(new GeomAPI_Pnt(0, 0, 0));
30 std::shared_ptr<GeomAPI_Dir> n, x;
31 if (theName == "XOY") {
32 n.reset(new GeomAPI_Dir(0, 0, 1));
33 x.reset(new GeomAPI_Dir(1, 0, 0));
34 } else if (theName == "XOZ") {
35 n.reset(new GeomAPI_Dir(0, -1, 0));
36 x.reset(new GeomAPI_Dir(1, 0, 0));
37 } else if (theName == "YOZ") {
38 n.reset(new GeomAPI_Dir(1, 0, 0));
39 x.reset(new GeomAPI_Dir(0, 1, 0));
42 return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(o, x, n));
45 //--------------------------------------------------------------------------------------
48 ModelAPI_Session::get()->startOperation();
52 ModelAPI_Session::get()->finishOperation();
56 auto aSession = ModelAPI_Session::get();
57 aSession->finishOperation();
58 aSession->startOperation();
61 //--------------------------------------------------------------------------------------
64 ModelAPI_Session::get()->undo();
68 ModelAPI_Session::get()->redo();
71 //--------------------------------------------------------------------------------------
74 ModelAPI_Session::get()->closeAll();
77 //--------------------------------------------------------------------------------------