-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFPInitialPlacement.py
More file actions
24 lines (17 loc) · 881 Bytes
/
FPInitialPlacement.py
File metadata and controls
24 lines (17 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import FreeCAD
import FPUtils
class InitialPlacements:
def __init__(self, obj):
obj.addProperty('App::PropertyPythonObject', 'InitialPlacements').InitialPlacements = {}
def saveInitialPlacements(self, obj):
obj.InitialPlacements.clear()
for child in FPUtils.getChildsWithPlacement(obj):
placement = FPUtils.freeCADPlacementToPropertyPythonObject(child.Placement)
obj.InitialPlacements[child.Name] = placement
def getInitialPlacement(self, obj, childName):
return FPUtils.propertyPythonObjectToFreeCADPlacement(obj.InitialPlacements[childName])
def hasNoChilds(self, obj):
return len( obj.InitialPlacements ) == 0
def moveToInitialPlacement(self, obj):
for child in FPUtils.getChildsWithPlacement(obj):
child.Placement = self.getInitialPlacement(obj, child.Name)