I have a prism, select one face of the prism, make the face to actual workingplane and draw a rectangle (-> obj)
Now I map the rectangle to the face by code:
Code: Select all
....
bk = FreeCADGui.Selection.getSelectionEx()[0] #The selected face
flae = bk.SubElementNames[0]
...
P0 = obj.Placement.Base #The origin of the rectangle
obj.Support = [(bk.Object,flae)] #map
obj.MapMode = 'FlatFace' #map
Code: Select all
P1 = bk.SubObjects[0].????????? # Should be the origin of the face in worldcoordinates
dP = P1-P0
P2 = obj.AttachmentOffset.Base
P2 = P2 + dP
obj.AttachmentOffset.Base = P2
Chri1