| | import FreeCAD as App |
| | import FreeCADGui |
| | import Arch |
| | import Draft |
| | import Part |
| | import Sketcher |
| | from bimtests.TestArchBaseGui import TestArchBaseGui |
| |
|
| |
|
| | class TestArchBuildingPartGui(TestArchBaseGui): |
| |
|
| | def testBuildingPart(self): |
| | """Create a BuildingPart from a wall with a window and check its shape.""" |
| | |
| | |
| | |
| | |
| | |
| | line = Draft.makeLine(App.Vector(0, 0, 0), App.Vector(3000, 0, 0)) |
| | wall = Arch.makeWall(line) |
| | sk = App.ActiveDocument.addObject("Sketcher::SketchObject", "Sketch001") |
| | sk.Placement.Rotation = App.Rotation(App.Vector(1, 0, 0), 90) |
| | sk.addGeometry(Part.LineSegment(App.Vector(500, 800, 0), App.Vector(1500, 800, 0))) |
| | sk.addGeometry(Part.LineSegment(App.Vector(1500, 800, 0), App.Vector(1500, 2000, 0))) |
| | sk.addGeometry(Part.LineSegment(App.Vector(1500, 2000, 0), App.Vector(500, 2000, 0))) |
| | sk.addGeometry(Part.LineSegment(App.Vector(500, 2000, 0), App.Vector(500, 800, 0))) |
| | sk.addConstraint(Sketcher.Constraint("Coincident", 0, 2, 1, 1)) |
| | sk.addConstraint(Sketcher.Constraint("Coincident", 1, 2, 2, 1)) |
| | sk.addConstraint(Sketcher.Constraint("Coincident", 2, 2, 3, 1)) |
| | sk.addConstraint(Sketcher.Constraint("Coincident", 3, 2, 0, 1)) |
| | App.ActiveDocument.recompute() |
| | win = Arch.makeWindow(sk) |
| | Arch.removeComponents(win, host=wall) |
| | App.ActiveDocument.recompute() |
| | bp = Arch.makeBuildingPart() |
| |
|
| | |
| | FreeCADGui.Selection.clearSelection() |
| | FreeCADGui.Selection.addSelection(self.doc_name, wall.Name) |
| | assert wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | App.ActiveDocument.recompute() |
| | assert not wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | assert wall.Visibility |
| |
|
| | bp.Group = [wall] |
| | App.ActiveDocument.recompute() |
| | |
| | |
| |
|
| | |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | App.ActiveDocument.recompute() |
| | assert not wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | assert wall.Visibility |
| |
|
| | |
| | FreeCADGui.Selection.clearSelection() |
| | FreeCADGui.Selection.addSelection(self.doc_name, bp.Name) |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | assert not wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | assert wall.Visibility |
| |
|
| | |
| | grp = App.ActiveDocument.addObject("App::DocumentObjectGroup", "Group") |
| | grp.Label = "Group" |
| | grp.Group = [wall] |
| | bp.Group = [grp] |
| | App.ActiveDocument.recompute() |
| | assert wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | App.ActiveDocument.recompute() |
| | assert not wall.Visibility |
| | FreeCADGui.runCommand("Std_ToggleVisibility", 0) |
| | App.ActiveDocument.recompute() |
| | assert wall.Visibility |
| |
|