Arch: initial BuildingPart development

This commit is contained in:
Yorik van Havre
2018-04-26 20:22:47 -03:00
parent 05c26826ca
commit 2bef80dcc4
12 changed files with 1350 additions and 6 deletions

View File

@@ -270,6 +270,11 @@ def autogroup(obj):
gr = g.Group
gr.append(obj)
g.Group = gr
else:
# Arch active container
a = FreeCADGui.ActiveDocument.ActiveView.getActiveObject("Arch")
if a:
a.addObject(obj)
def dimSymbol(symbol=None,invert=False):
"returns the current dim symbol from the preferences as a pivy SoMarkerSet"

View File

@@ -302,7 +302,14 @@ class plane:
def getRotation(self):
"returns a placement describing the working plane orientation ONLY"
m = DraftVecUtils.getPlaneRotation(self.u,self.v,self.axis)
return FreeCAD.Placement(m)
p = FreeCAD.Placement(m)
# Arch active container
if FreeCAD.GuiUp:
import FreeCADGui
a = FreeCADGui.ActiveDocument.ActiveView.getActiveObject("Arch")
if a:
p = a.Placement.inverse().multiply(p)
return p
def getPlacement(self,rotated=False):
"returns the placement of the working plane"
@@ -318,10 +325,27 @@ class plane:
self.u.y,self.v.y,self.axis.y,self.position.y,
self.u.z,self.v.z,self.axis.z,self.position.z,
0.0,0.0,0.0,1.0)
return FreeCAD.Placement(m)
p = FreeCAD.Placement(m)
# Arch active container
if FreeCAD.GuiUp:
import FreeCADGui
a = FreeCADGui.ActiveDocument.ActiveView.getActiveObject("Arch")
if a:
p = a.Placement.inverse().multiply(p)
return p
def getNormal(self):
n = self.axis
# Arch active container
if FreeCAD.GuiUp:
import FreeCADGui
a = FreeCADGui.ActiveDocument.ActiveView.getActiveObject("Arch")
if a:
n = a.Placement.inverse().Rotation.multVec(n)
return n
def setFromPlacement(self,pl,rebase=False):
"sets the working plane from a placement (rotaton ONLY, unless rebaee=True)"
"sets the working plane from a placement (rotaton ONLY, unless rebase=True)"
rot = FreeCAD.Placement(pl).Rotation
self.u = rot.multVec(FreeCAD.Vector(1,0,0))
self.v = rot.multVec(FreeCAD.Vector(0,1,0))