[BimWindow] ArchWindow/MakeWindow Normal Default Auto & SketchArch Support Sill Property (#21568)

https://github.com/FreeCAD/FreeCAD/pull/21261
Historically, the normal of a Window object was deduced by the orientation of the Base Sketch and hardcoded in the Normal property.
Now with the new AutoNormalReversed property/flag (above PR), set True as default, the auto Normal previously in opposite direction to is now consistent with that previously hardcoded.
With the normal set to 'auto', window object would not suffer weird shape if the Base Sketch is rotated by some reason.
The Normal property is set to  'auto' (0,0,0) default following the above PR.

https://github.com/FreeCAD/FreeCAD/pull/21005
BIM: Allow changing Sill parameter in Properties for Window #21005
Ground work is added to support Window augmented by SketchArch Parametric Placement feature (PR to ArchWindow.py to be submitted separately)
This commit is contained in:
paul
2025-06-03 17:15:18 +08:00
committed by GitHub
parent 4dff82f7a3
commit 93b53af0d1
2 changed files with 19 additions and 4 deletions

View File

@@ -1785,7 +1785,12 @@ def makeWindow(baseobj=None, width=None, height=None, parts=None, name=None):
if height:
window.Height = height
if baseobj:
window.Normal = baseobj.Placement.Rotation.multVec(FreeCAD.Vector(0, 0, -1))
# 2025.5.25
# Historically, this normal was deduced by the orientation of the Base Sketch and hardcoded in the Normal property.
# Now with the new AutoNormalReversed property/flag, set True as default, the auto Normal previously in opposite direction to is now consistent with that previously hardcoded.
# With the normal set to 'auto', window object would not suffer weird shape if the Base Sketch is rotated by some reason.
# Keep the property be 'auto' (0,0,0) here.
#obj.Normal = baseobj.Placement.Rotation.multVec(FreeCAD.Vector(0, 0, -1))
window.Base = baseobj
if parts is not None:
window.WindowParts = parts

View File

@@ -210,7 +210,12 @@ class Arch_Window:
break
FreeCADGui.doCommand("win = FreeCAD.ActiveDocument.getObject('" + o.Name + "')")
FreeCADGui.doCommand("win.Base.Placement = pl")
FreeCADGui.doCommand("win.Normal = pl.Rotation.multVec(FreeCAD.Vector(0, 0, -1))")
# 2025.5.25
# Historically, this normal was deduced by the orientation of the Base Sketch and hardcoded in the Normal property.
# Now with the new AutoNormalReversed property/flag, set True as default, the auto Normal previously in opposite direction to is now consistent with that previously hardcoded.
# With the normal set to 'auto', window object would not suffer weird shape if the Base Sketch is rotated by some reason.
# Keep the property be 'auto' (0,0,0) here.
#FreeCADGui.doCommand("win.Normal = pl.Rotation.multVec(FreeCAD.Vector(0, 0, -1))")
FreeCADGui.doCommand("win.Width = " + str(self.Width))
FreeCADGui.doCommand("win.Height = " + str(self.Height))
FreeCADGui.doCommand("win.Base.recompute()")
@@ -233,8 +238,13 @@ class Arch_Window:
hasattr(ArchSketchObject, 'attachToHost') and
hasattr(FreeCAD, 'ArchSketchLock') and
FreeCAD.ArchSketchLock):
# Window sketch's stay at orgin is good if addon exists
FreeCADGui.doCommand("win = Arch.makeWindowPreset('" + WindowPresets[self.Preset] + "' " + wp + ")")
if self.Include:
# Window base sketch's placement stay at orgin is good if addon exists and self.Include
FreeCADGui.doCommand("win = Arch.makeWindowPreset('" + WindowPresets[self.Preset] + "' " + wp + ", window_sill=" + str(self.Sill.Value) + ")")
else:
# Window base sketch's placement follow getPoint placement if addon exists but NOT self.Include
FreeCADGui.doCommand("win = Arch.makeWindowPreset('" + WindowPresets[self.Preset] + "' " + wp + ", placement=pl, window_sill=" + str(self.Sill.Value) + ")")
FreeCADGui.doCommand("win.AttachToAxisOrSketch = 'None'")
FreeCADGui.doCommand("FreeCADGui.Selection.addSelection(win)")
w = FreeCADGui.Selection.getSelection()[0]
FreeCADGui.doCommand("FreeCAD.SketchArchPl = pl")