1 """General purpose Interface
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
8 import geom # To be removed when gp_Ax3 will be Pythonized
11 def moduleDocument ():
12 """Returns the main document (the Partset) created or open from the Modeler.
13 This document is unique in the application session.
15 return ModelAPI_Session.get().moduleDocument()
18 def activeDocument ():
19 """Returns the active document.
20 This document can be either the main application document (i.e. the Partset) or one of documents
21 referred to by the main document (a Part).
23 return ModelAPI_Session.get().activeDocument()
26 def defaultPlane (name):
27 """Returns one of the three planes defined by the global coordinate system.
28 These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
30 # Temporary implementation before the availability of default planes.
32 o = GeomAPI_Pnt( 0, 0, 0 )
34 n = GeomAPI_Dir( 0, 0, 1)
35 x = GeomAPI_Dir( 1, 0, 0)
37 n = GeomAPI_Dir( 0, 1, 0)
38 x = GeomAPI_Dir( 1, 0, 0)
40 n = GeomAPI_Dir( 1, 0, 0)
41 x = GeomAPI_Dir( 0, 1, 0)
43 return geom.Ax3( o, n, x )
47 """Starts a data structure transaction, as such making a control point for being able to discard or undo
48 all operations done during this transaction.
50 ModelAPI_Session.get().startOperation()
54 """Commits the data structure transaction and makes all operations done since the last control point undo-able."""
55 ModelAPI_Session.get().finishOperation()
59 """Commits the data structure transaction and makes all operations done since the last control point undo-able."""
60 session = ModelAPI_Session.get()
61 session.finishOperation()
62 session.startOperation()
66 """Rolls-back the data structure to the previous control point."""
67 ModelAPI_Session.get().undo()
71 """Restore the data structure rolled-back by the last undo."""
72 ModelAPI_Session.get().redo()