Arch: Updates related to the PlaneGui class (#11153)

Related issue:
#5603.
This commit is contained in:
Roy-043
2023-10-23 18:42:20 +02:00
committed by GitHub
parent 26d748587b
commit 3a396e1ed3
12 changed files with 75 additions and 82 deletions

View File

@@ -186,6 +186,7 @@ class _CommandWindow:
self.Include = True
self.baseFace = None
self.wparams = ["Width","Height","H1","H2","H3","W1","W2","O1","O2"]
self.wp = None
# autobuild mode
if FreeCADGui.Selection.getSelectionEx():
@@ -235,8 +236,8 @@ class _CommandWindow:
return
# interactive mode
if hasattr(FreeCAD,"DraftWorkingPlane"):
FreeCAD.DraftWorkingPlane.setup()
import WorkingPlane
self.wp = WorkingPlane.get_working_plane()
self.tracker = DraftTrackers.boxTracker()
self.tracker.length(self.Width)
@@ -274,8 +275,8 @@ class _CommandWindow:
point = point.add(FreeCAD.Vector(0,0,self.Sill))
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Window"))
FreeCADGui.doCommand("import math, FreeCAD, Arch, DraftGeomUtils")
FreeCADGui.doCommand("wp = FreeCAD.DraftWorkingPlane")
FreeCADGui.doCommand("import math, FreeCAD, Arch, DraftGeomUtils, WorkingPlane")
FreeCADGui.doCommand("wp = WorkingPlane.get_working_plane()")
if self.baseFace is not None:
FreeCADGui.doCommand("face = FreeCAD.ActiveDocument." + self.baseFace[0].Name + ".Shape.Faces[" + str(self.baseFace[1]) + "]")
@@ -342,9 +343,8 @@ class _CommandWindow:
delta = FreeCAD.Vector(self.Width/2,self.Thickness/2,self.Height/2)
delta = delta.add(FreeCAD.Vector(0,0,self.Sill))
wp = FreeCAD.DraftWorkingPlane
if self.baseFace is None:
rot = FreeCAD.Rotation(wp.u,wp.v,-wp.axis,"XZY")
rot = FreeCAD.Rotation(self.wp.u,self.wp.v,-self.wp.axis,"XZY")
self.tracker.setRotation(rot)
if info:
if "Face" in info['Component']:
@@ -353,7 +353,7 @@ class _CommandWindow:
self.baseFace = [o,int(info['Component'][4:])-1]
#print("switching to ",o.Label," face ",self.baseFace[1])
f = o.Shape.Faces[self.baseFace[1]]
p = DraftGeomUtils.placement_from_face(f,vec_z=wp.axis,rotated=True)
p = DraftGeomUtils.placement_from_face(f,vec_z=self.wp.axis,rotated=True)
rot = p.Rotation
self.tracker.setRotation(rot)
r = self.tracker.trans.rotation.getValue().getValue()