BIM: BimViews upgrade

This commit is contained in:
Yorik van Havre
2024-12-11 09:23:59 +01:00
committed by Yorik van Havre
parent 438c6d730f
commit fbd7d201d5
18 changed files with 1043 additions and 150 deletions
+23 -1
View File
@@ -114,7 +114,10 @@ def makeBuildingPart(objectslist=None,baseobj=None,name=None):
if FreeCAD.GuiUp:
ArchBuildingPart.ViewProviderBuildingPart(obj.ViewObject)
if objectslist:
obj.addObjects(objectslist)
if isinstance(objectslist,(list,tuple)):
obj.addObjects(objectslist)
else:
obj.addObject(objectslist)
return obj
@@ -147,6 +150,25 @@ def makeBuilding(objectslist=None,baseobj=None,name=None):
return obj
def make2DDrawing(objectslist=None,baseobj=None,name=None):
"""makes a BuildingPart and turns it into a 2D drawing view"""
obj = makeBuildingPart(objectslist)
obj.Label = name if name else translate("Arch","Drawing")
obj.IfcType = "Annotation"
obj.ObjectType = "DRAWING"
obj.setEditorMode("Area",2)
obj.setEditorMode("Height",2)
obj.setEditorMode("LevelOffset",2)
obj.setEditorMode("OnlySolids",2)
obj.setEditorMode("HeightPropagate",2)
if FreeCAD.GuiUp:
obj.ViewObject.DisplayOffset = FreeCAD.Placement()
obj.ViewObject.ShowLevel = False
return obj
def convertFloors(floor=None):
"""convert the given Floor or Building (or all Arch Floors from the
+2
View File
@@ -531,6 +531,8 @@ class ViewProviderBuildingPart:
return ":/icons/Arch_Floor_Tree.svg"
elif self.Object.IfcType == "Building":
return ":/icons/Arch_Building_Tree.svg"
elif self.Object.IfcType == "Annotation":
return ":/icons/BIM_ArchView.svg"
return ":/icons/Arch_BuildingPart_Tree.svg"
def attach(self,vobj):
+1
View File
@@ -106,6 +106,7 @@ SET(bimcommands_SRCS
bimcommands/BimDiff.py
bimcommands/BimDimensions.py
bimcommands/BimDoor.py
bimcommands/BimDrawingView.py
bimcommands/BimEmptyTrash.py
bimcommands/BimEquipment.py
bimcommands/BimExamples.py
+4 -2
View File
@@ -95,14 +95,16 @@ class BIMWorkbench(Workbench):
"BIM_DimensionVertical",
"BIM_Leader",
"Draft_Label",
"Draft_Hatch",
"Arch_Axis",
"Arch_AxisSystem",
"Arch_Grid",
"Arch_SectionPlane",
"Draft_Hatch",
"BIM_DrawingView",
"BIM_Shape2DView",
"BIM_Shape2DCut",
"BIM_TDPage",
"BIM_TDView",
"BIM_Shape2DView",
]
self.bimtools = [
+4 -2
View File
@@ -81,6 +81,7 @@
<file>icons/Arch_ToggleSubs.svg</file>
<file>icons/Arch_Truss.svg</file>
<file>icons/Arch_Truss_Tree.svg</file>
<file>icons/Arch_View_Cut.svg</file>
<file>icons/Arch_Wall.svg</file>
<file>icons/Arch_Wall_Clone.svg</file>
<file>icons/Arch_Wall_Tree.svg</file>
@@ -89,6 +90,7 @@
<file>icons/Arch_Window_Clone.svg</file>
<file>icons/Arch_Window_Tree.svg</file>
<file>icons/BIMWorkbench.svg</file>
<file>icons/BIM_ArchView.svg</file>
<file>icons/BIM_Background.svg</file>
<file>icons/BIM_Beam.svg</file>
<file>icons/BIM_Box.svg</file>
@@ -108,6 +110,7 @@
<file>icons/BIM_IfcProperties.svg</file>
<file>icons/BIM_IfcQuantities.svg</file>
<file>icons/BIM_ImagePlane.svg</file>
<file>icons/BIM_InsertView.svg</file>
<file>icons/BIM_Layers.svg</file>
<file>icons/BIM_Leader.svg</file>
<file>icons/BIM_Levels.svg</file>
@@ -115,6 +118,7 @@
<file>icons/BIM_Material.svg</file>
<file>icons/BIM_MoveView.svg</file>
<file>icons/BIM_Nudge.svg</file>
<file>icons/BIM_PageDefault.svg</file>
<file>icons/BIM_Phases.svg</file>
<file>icons/BIM_Preflight.svg</file>
<file>icons/BIM_Project.svg</file>
@@ -142,8 +146,6 @@
<file>icons/Tree_Part.svg</file>
<file>icons/banner.png</file>
<file>icons/preferences-bim.svg</file>
<file>icons/techdraw-ArchView.svg</file>
<file>icons/techdraw-PageDefault.svg</file>
<file>icons/warning.svg</file>
<file>icons/IFC/IfcBeam.svg</file>
<file>icons/IFC/IfcBuilding.svg</file>
@@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64px"
height="64px"
id="svg2816"
version="1.1"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="Arch_View_Cut.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2818">
<linearGradient
id="linearGradient3071"
inkscape:collect="always">
<stop
id="stop3073"
offset="0"
style="stop-color:#c4a000;stop-opacity:1" />
<stop
id="stop3075"
offset="1"
style="stop-color:#fce94f;stop-opacity:1" />
</linearGradient>
<linearGradient
id="linearGradient3633">
<stop
style="stop-color:#fff652;stop-opacity:1;"
offset="0"
id="stop3635" />
<stop
style="stop-color:#ffbf00;stop-opacity:1;"
offset="1"
id="stop3637" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2824" />
<inkscape:perspective
id="perspective3622"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3622-9"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3653"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3675"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3697"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3720"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3742"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3764"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3785"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3806"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3806-3"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3835"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3614"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3614-8"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3643"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3643-3"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-5"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-8"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3746"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
patternTransform="matrix(0.67643728,-0.81829155,2.4578314,1.8844554,-26.450606,18.294947)"
id="pattern5231"
xlink:href="#Strips1_1-4"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5224"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
inkscape:stockid="Stripes 1:1"
id="Strips1_1-4"
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
height="1"
width="2"
patternUnits="userSpaceOnUse"
inkscape:collect="always">
<rect
id="rect4483-4"
height="2"
width="1"
y="-0.5"
x="0"
style="fill:black;stroke:none" />
</pattern>
<inkscape:perspective
id="perspective5224-9"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,39.618381,8.9692804)"
id="pattern5231-4"
xlink:href="#Strips1_1-6"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5224-3"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
inkscape:stockid="Stripes 1:1"
id="Strips1_1-6"
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
height="1"
width="2"
patternUnits="userSpaceOnUse"
inkscape:collect="always">
<rect
id="rect4483-0"
height="2"
width="1"
y="-0.5"
x="0"
style="fill:black;stroke:none" />
</pattern>
<pattern
patternTransform="matrix(0.66513382,-1.0631299,2.4167603,2.4482973,-49.762569,2.9546807)"
id="pattern5296"
xlink:href="#pattern5231-3"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5288"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,-26.336284,10.887197)"
id="pattern5231-3"
xlink:href="#Strips1_1-4-3"
inkscape:collect="always" />
<pattern
inkscape:stockid="Stripes 1:1"
id="Strips1_1-4-3"
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
height="1"
width="2"
patternUnits="userSpaceOnUse"
inkscape:collect="always">
<rect
id="rect4483-4-6"
height="2"
width="1"
y="-0.5"
x="0"
style="fill:black;stroke:none" />
</pattern>
<pattern
patternTransform="matrix(0.42844886,-0.62155849,1.5567667,1.431396,27.948414,13.306456)"
id="pattern5330"
xlink:href="#Strips1_1-9"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5323"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<pattern
inkscape:stockid="Stripes 1:1"
id="Strips1_1-9"
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
height="1"
width="2"
patternUnits="userSpaceOnUse"
inkscape:collect="always">
<rect
id="rect4483-3"
height="2"
width="1"
y="-0.5"
x="0"
style="fill:black;stroke:none" />
</pattern>
<inkscape:perspective
id="perspective5361"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5383"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5411"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3866"
id="linearGradient3872"
x1="35"
y1="53"
x2="24"
y2="9"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient3866">
<stop
style="stop-color:#d3d7cf;stop-opacity:1"
offset="0"
id="stop3868" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop3870" />
</linearGradient>
<linearGradient
y2="9"
x2="24"
y1="64"
x1="34"
gradientUnits="userSpaceOnUse"
id="linearGradient3120-3"
xlink:href="#linearGradient3071"
inkscape:collect="always"
gradientTransform="translate(-2,-8)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.0810395"
inkscape:cx="26.470961"
inkscape:cy="26.766176"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:object-nodes="true"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1">
<inkscape:grid
type="xygrid"
id="grid3032"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata2821">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>[wmayer]</dc:title>
</cc:Agent>
</dc:creator>
<dc:title>Arch_Floor</dc:title>
<dc:date>2011-10-10</dc:date>
<dc:relation>https://www.freecad.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/Arch/Resources/icons/Arch_</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#22200e;stroke-width:2.64567;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="M 30.000001,10.000001 V 20 h 8 v 11.999999 h 6 V 20 h 8 V 44 H 44.327274 V 39.999999 H 38.000001 V 44 h -2.000002 v 7.999999 l 2.870608,3e-6 h 4.49 12.652727 2.993333 H 62 v -42 z"
id="path4039-2-6" />
<path
id="path4039-2"
style="color:#000000;display:inline;overflow:visible;visibility:visible;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.64567;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
sodipodi:type="inkscape:offset"
inkscape:radius="-1.0020038"
inkscape:original="M 32 12 L 32 18 C 34.027246 18.0281 36.079535 17.943756 38.091797 18.041016 C 38.672197 18.407545 39.627056 18.425166 39.71875 19.248047 C 40.238678 20.288423 39.907791 21.48178 40 22.599609 L 40 30 L 42 30 L 42 20 C 42.320651 19.505826 42.379747 18.73116 42.873047 18.421875 C 43.58021 18.086686 44.314813 17.906472 45.099609 18 C 47.426879 18.02799 49.779502 17.943916 52.091797 18.041016 C 52.672197 18.407545 53.627056 18.425166 53.71875 19.248047 C 54.238678 20.288423 53.907791 21.48178 54 22.599609 L 54 44 C 53.679349 44.494174 53.620253 45.26884 53.126953 45.578125 C 52.41979 45.913314 51.685187 46.093528 50.900391 46 C 48.682438 45.97228 46.439326 46.055734 44.236328 45.958984 C 43.655928 45.592455 42.701069 45.574834 42.609375 44.751953 C 42.142573 43.901957 42.386573 42.923943 42.328125 42 L 40 42 C 39.94863 42.955536 40.198641 43.975555 39.626953 44.818359 C 39.515238 45.536282 38.886674 45.699183 38.285156 45.892578 C 37.677111 46.072176 38.148633 47.001863 38 47.5 L 38 50 L 60 50 L 60 12 L 32 12 z "
d="m 33.001953,13.001953 v 4.003906 c 1.687488,-9.85e-4 3.400069,-0.04888 5.138672,0.03516 a 1.002104,1.002104 0 0 1 0.486328,0.152343 c 0.08658,0.05467 0.436575,0.159627 0.890625,0.375 0.427922,0.20298 1.002421,0.732697 1.144531,1.453125 0.23528,0.557052 0.320491,1.091664 0.335938,1.59375 V 20 a 1.002104,1.002104 0 0 1 0.162109,-0.544922 c 0.04549,-0.07011 0.140553,-0.33144 0.279297,-0.68164 0.138745,-0.350201 0.350005,-0.856096 0.900391,-1.201172 a 1.002104,1.002104 0 0 1 0.103515,-0.05664 c 0.824246,-0.390685 1.767454,-0.629886 2.775391,-0.509766 l -0.107422,-0.0078 c 2.295024,0.0276 4.658453,-0.0583 7.023438,0.04102 a 1.002104,1.002104 0 0 1 0.492187,0.154297 c 0.08658,0.05467 0.436575,0.159627 0.890625,0.375 0.427922,0.20298 1.002421,0.732697 1.144531,1.453125 0.582721,1.37966 0.268453,2.677987 0.335938,3.496094 a 1.002104,1.002104 0 0 1 0.0039,0.08203 V 44 a 1.002104,1.002104 0 0 1 -0.162109,0.544922 c -0.04549,0.07011 -0.140553,0.33144 -0.279297,0.68164 -0.138745,0.350201 -0.350005,0.856096 -0.900391,1.201172 a 1.002104,1.002104 0 0 1 -0.103515,0.05664 c -0.824246,0.390685 -1.767454,0.629886 -2.775391,0.509766 l 0.107422,0.0078 c -2.184383,-0.0273 -4.439251,0.05815 -6.697266,-0.04102 a 1.002104,1.002104 0 0 1 -0.490234,-0.154297 c -0.08658,-0.05467 -0.436575,-0.159627 -0.890625,-0.375 -0.427388,-0.202727 -0.99949,-0.732165 -1.142578,-1.451172 -0.326636,-0.736811 -0.398953,-1.394055 -0.369141,-1.978516 h -0.27539 c 0.02789,0.621586 -0.07466,1.311791 -0.46875,2.064453 -0.130836,0.576068 -0.492647,1.089013 -0.882813,1.333985 -0.272685,0.171209 -0.48098,0.217684 -0.705078,0.291015 0.04427,0.222004 0.170171,0.505743 -0.0059,1.095703 L 39.001953,47.5 v 1.498047 H 58.998047 V 13.001953 Z" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#22200e;stroke-width:2.64567;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 2.1333361,10.000002 v 6.461539 35.538461 H 5.1266693 8.1200027 L 28.000001,52 V 44 H 10.000002 V 31.999999 H 24 v -6 H 10.000002 L 10,20 h 6.000002 v -9.999999 z"
id="rect5347-0-3" />
<path
id="rect5347-0"
style="display:inline;overflow:visible;vector-effect:none;stroke-width:2.64567;stroke-linejoin:round;marker:none;enable-background:accumulate"
d="m 4.8867188,12.753906 v 3.707032 32.785156 H 25.246094 V 46.753906 H 10 A 0.7533385,0.7533385 0 0 1 9.5898438,46.632812 C 9.4757996,46.558814 9.1995547,46.461352 8.8632812,46.328125 8.5270078,46.194898 8.0810054,46.002329 7.7832031,45.527344 a 0.7533385,0.7533385 0 0 1 -0.042969,-0.07813 C 7.3633252,44.654038 7.1384335,43.763091 7.2519531,42.810547 l -0.00586,0.08984 V 32 A 0.7533385,0.7533385 0 0 1 7.3671875,31.589844 C 7.4411863,31.4758 7.5386482,31.199555 7.671875,30.863281 7.8051018,30.527008 7.9976707,30.081006 8.4726562,29.783203 a 0.7533385,0.7533385 0 0 1 0.078125,-0.04297 c 0.7951807,-0.376908 1.6861278,-0.6018 2.6386718,-0.488281 l -0.08984,-0.0059 H 21.246094 V 28.753906 H 10 A 0.7533385,0.7533385 0 0 1 9.5898438,28.632812 C 9.4757996,28.558814 9.1995547,28.461352 8.8632812,28.328125 8.5270078,28.194898 8.0810054,28.002329 7.7832031,27.527344 a 0.7533385,0.7533385 0 0 1 -0.042969,-0.07813 C 7.3633252,26.654038 7.1384335,25.763091 7.2519531,24.810547 l -0.00586,0.07617 c 0.027726,-1.626196 -0.057903,-3.321806 0.042969,-5.023438 a 0.7533385,0.7533385 0 0 1 0.1152344,-0.357422 c 0.086596,-0.137126 0.1887618,-0.496518 0.3886719,-0.917968 0.1896041,-0.399724 0.6421355,-0.894706 1.28125,-1.013672 C 10.376745,17.004474 11.648241,17.323322 12.537109,17.25 l -0.115234,0.01758 c 0.427912,-0.10436 0.61613,-0.03313 0.824219,0.002 v -4.515625 z" />
<path
style="color:#000000;fill:none;stroke-width:2.07015;stroke-linejoin:round;-inkscape-stroke:none"
d="M -3.4740802,5.3585539 H 68.127243 c 0.244029,0 0.440485,0.196456 0.440485,0.4404844 V 58.398965 c 0,0.244029 -0.196456,0.440485 -0.440485,0.440485 H -3.4740802 c -0.2440284,0 -0.4404844,-0.196456 -0.4404844,-0.440485 V 5.7990383 c 0,-0.2440284 0.196456,-0.4404844 0.4404844,-0.4404844 z"
id="path2992" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
width="64"
height="64"
id="svg4024"
sodipodi:docname="BIM_InsertView.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview19"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="9.269728"
inkscape:cx="36.948226"
inkscape:cy="31.176751"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg4024" />
<defs
id="defs4026">
<linearGradient
xlink:href="#linearGradient3775-1"
id="linearGradient3781-9"
x1="10"
y1="39.999996"
x2="53"
y2="25.999996"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48)" />
<linearGradient
id="linearGradient3775-1">
<stop
style="stop-color:#d3d7cf;stop-opacity:1;"
offset="0"
id="stop3777-2" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop3779-7" />
</linearGradient>
</defs>
<metadata
id="metadata4029">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:relation>https://www.freecad.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer4"
style="display:inline"
transform="translate(0,16)">
<rect
style="fill:#d3d7cf;fill-opacity:1;stroke:#2e3436;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2987"
width="45.999996"
height="58.000004"
x="-38.999996"
y="3"
transform="rotate(-90)" />
<rect
style="fill:url(#linearGradient3781-9);fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2987-1"
width="41.999996"
height="54.000004"
x="-36.999996"
y="5"
transform="rotate(-90)" />
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect3894"
width="50"
height="38"
x="7"
y="-3" />
<rect
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="rect4664"
width="23.999994"
height="12.000004"
x="33"
y="23" />
<path
style="fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 37,27 h 15.398794 v 0"
id="path4666" />
<path
style="fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 37,31 h 15.642526 v 0"
id="path4666-7" />
</g>
<rect
style="fill:#89ccff;stroke:#0310ff;stroke-width:4;stroke-linejoin:round;stroke-dasharray:8, 4;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;fill-opacity:1"
id="rect354"
width="33.723022"
height="16.97567"
x="14.798182"
y="17.402468"
rx="0.42579147" />
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

+12 -2
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>485</height>
<width>322</width>
<height>502</height>
</rect>
</property>
<property name="windowTitle">
@@ -70,6 +70,16 @@
</property>
</column>
</widget>
<widget class="QTreeWidget" name="viewtree">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>2D Views</string>
</property>
</column>
</widget>
</widget>
</item>
</layout>
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>522</width>
<height>851</height>
<height>892</height>
</rect>
</property>
<property name="windowTitle">
@@ -49,6 +49,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
@@ -302,6 +308,13 @@
<string>Other</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QLabel" name="label_RebarOffset">
<property name="text">
<string>Rebar offset</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="Gui::PrefCheckBox" name="checkBox_WallSketches">
<property name="text">
@@ -318,6 +331,32 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_StairsLength">
<property name="text">
<string>Stair length</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsWidth">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>1000.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsWidth</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_PipeDiameter">
<property name="text">
@@ -331,10 +370,10 @@
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>50.0</double>
<double>50.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>PipeDiameter</cstring>
@@ -344,20 +383,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_RebarDiameter">
<property name="text">
<string>Rebar diameter</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_RebarDiameter">
<property name="minimumSize">
@@ -370,10 +395,10 @@
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>6.0</double>
<double>6.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>RebarDiameter</cstring>
@@ -383,23 +408,16 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_RebarOffset">
<property name="text">
<string>Rebar offset</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_RebarOffset">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>30.0</double>
<double>30.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>RebarOffset</cstring>
@@ -409,91 +427,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_StairsLength">
<property name="text">
<string>Stair length</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsLength">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
</property>
<property name="rawValue" stdset="0">
<double>4500.0</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsLength</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_StairsWidth">
<property name="text">
<string>Stair width</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsWidth">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
</property>
<property name="rawValue" stdset="0">
<double>1000.0</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsWidth</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_StairsHeight">
<property name="text">
<string>Stair height</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsHeight">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<number>0.0</number>
</property>
<property name="rawValue" stdset="0">
<double>3000.0</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsHeight</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_StairsSteps">
<property name="text">
<string>Number of stair steps</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="Gui::PrefSpinBox" name="spinBox_StairsSteps">
<property name="value">
@@ -507,6 +440,101 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_StairsSteps">
<property name="text">
<string>Number of stair steps</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_RebarDiameter">
<property name="text">
<string>Rebar diameter</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_StairsHeight">
<property name="text">
<string>Stair height</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsHeight">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>3000.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsHeight</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::PrefUnitSpinBox" name="spinBox_StairsLength">
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>4500.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsLength</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_StairsWidth">
<property name="text">
<string>Stair width</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="Gui::PrefCheckBox" name="checkBox">
<property name="toolTip">
<string>When clicking a view or level in the BIM views manager, this switches the background to plain color when activating a 2D view, and to gradient color when activating a level</string>
</property>
<property name="text">
<string>Switch backgrounds</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BimViewsSwitchBackground</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/BIM</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -515,6 +543,12 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
@@ -522,6 +556,26 @@
<layoutdefault spacing="6" margin="11"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>
<header>Gui/Widgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefSpinBox</class>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefColorButton</class>
<extends>Gui::ColorButton</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
@@ -532,31 +586,11 @@
<extends>QComboBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefSpinBox</class>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefUnitSpinBox</class>
<extends>Gui::QuantitySpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>
<header>Gui/Widgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefColorButton</class>
<extends>Gui::ColorButton</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
+48
View File
@@ -32,6 +32,7 @@ import Arch
import Draft
import Part
import Sketcher
import TechDraw
from draftutils.messages import _msg
@@ -758,6 +759,53 @@ class ArchTest(unittest.TestCase):
App.ActiveDocument.recompute()
assert wall.Visibility
def testViewGeneration(self):
"""Tests the whole TD view generation workflow"""
operation = "View generation"
_msg(" Test '{}'".format(operation))
# Create a few objects
points = [App.Vector(0.0, 0.0, 0.0), App.Vector(2000.0, 0.0, 0.0)]
line = Draft.make_wire(points)
wall = Arch.makeWall(line, height=2000)
wpl = App.Placement(App.Vector(500,0,1500), App.Vector(1,0,0),-90)
win = Arch.makeWindowPreset('Fixed', width=1000.0, height=1000.0, h1=50.0, h2=50.0, h3=50.0, w1=100.0, w2=50.0, o1=0.0, o2=50.0, placement=wpl)
win.Hosts = [wall]
profile = Arch.makeProfile([169, 'HEA', 'HEA100', 'H', 100.0, 96.0, 5.0, 8.0])
column = Arch.makeStructure(profile, height=2000.0)
column.Profile = "HEA100"
column.Placement.Base = App.Vector(500.0, 600.0, 0.0)
level = Arch.makeFloor()
level.addObjects([wall, column])
App.ActiveDocument.recompute()
# Create a drawing view
section = Arch.makeSectionPlane(level)
drawing = Arch.make2DDrawing()
view = Draft.make_shape2dview(section)
cut = Draft.make_shape2dview(section)
cut.InPlace = False
cut.ProjectionMode = "Cutfaces"
drawing.addObjects([view, cut])
App.ActiveDocument.recompute()
# Create a TD page
tpath = os.path.join(App.getResourceDir(),"Mod","TechDraw","Templates","A3_Landscape_blank.svg")
page = App.ActiveDocument.addObject("TechDraw::DrawPage", "Page")
template = App.ActiveDocument.addObject("TechDraw::DrawSVGTemplate", "Template")
template.Template = tpath
page.Template = template
view = App.ActiveDocument.addObject("TechDraw::DrawViewDraft", "DraftView")
view.Source = drawing
page.addView(view)
view.Scale = 1.0
view.X = "20cm"
view.Y = "15cm"
App.ActiveDocument.recompute()
assert True
def tearDown(self):
App.closeDocument("ArchTest")
pass
+83
View File
@@ -0,0 +1,83 @@
# ***************************************************************************
# * *
# * Copyright (c) 2024 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
"""The BIM DrawingView command"""
import os
import FreeCAD
import FreeCADGui
from bimcommands import BimBuildingPart
QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
translate = FreeCAD.Qt.translate
PARAMS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM")
class BIM_DrawingView:
"""The command definition for the Drawing View command"""
def GetResources(self):
return {'Pixmap' : 'BIM_ArchView',
'MenuText': QT_TRANSLATE_NOOP("BIM_DrawingView","2D Drawing"),
'Accel': "V, D",
'ToolTip': QT_TRANSLATE_NOOP("BIM_DrawingView","Creates a drawing container to contain elements of a 2D view")}
def IsActive(self):
v = hasattr(FreeCADGui.getMainWindow().getActiveWindow(), "getSceneGraph")
return v
def Activated(self):
import Draft
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create 2D View"))
FreeCADGui.addModule("Arch")
FreeCADGui.addModule("Draft")
FreeCADGui.addModule("WorkingPlane")
FreeCADGui.doCommand("obj = Arch.make2DDrawing()")
FreeCADGui.doCommand("Draft.autogroup(obj)")
s = FreeCADGui.Selection.getSelection()
if len(s) == 1:
s = s[0]
if Draft.getType(s) == "SectionPlane":
FreeCADGui.doCommand("vobj = Draft.make_shape2dview(FreeCAD.ActiveDocument."+s.Name+")")
FreeCADGui.doCommand("vobj.Label = \""+translate("BIM","Viewed lines")+"\"")
FreeCADGui.doCommand("vobj.InPlace = False")
FreeCADGui.doCommand("obj.addObject(vobj)")
bb = FreeCAD.BoundBox()
for so in s.Objects:
if hasattr(so, "Shape"):
bb.add(so.Shape.BoundBox)
if bb.isInside(s.Shape.CenterOfMass):
FreeCADGui.doCommand("cobj = Draft.make_shape2dview(FreeCAD.ActiveDocument."+s.Name+")")
FreeCADGui.doCommand("cobj.Label = \""+translate("BIM","Cut lines")+"\"")
FreeCADGui.doCommand("cobj.InPlace = False")
FreeCADGui.doCommand("cobj.ProjectionMode = \"Cutfaces\"")
FreeCADGui.doCommand("obj.addObject(cobj)")
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
FreeCADGui.addCommand('BIM_DrawingView', BIM_DrawingView())
+1 -1
View File
@@ -38,7 +38,7 @@ class Arch_SectionPlane:
def GetResources(self):
return {'Pixmap' : 'Arch_SectionPlane',
return {'Pixmap' : 'Arch_SectionPlane_Tree',
'Accel': "S, E",
'MenuText': QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"),
'ToolTip': QT_TRANSLATE_NOOP("Arch_SectionPlane","Creates a section plane object, including the selected objects")}
+17 -1
View File
@@ -38,7 +38,8 @@ class BIM_Shape2DView(gui_shape2dview.Shape2DView):
def GetResources(self):
d = super().GetResources()
d["Pixmap"] = "Arch_BuildingPart_Tree"
d["MenuText"] = QT_TRANSLATE_NOOP("BIM_Shape2DView", "Shape-based view")
d["MenuText"] = QT_TRANSLATE_NOOP("BIM_Shape2DView", "Section view")
d['Accel'] = "V, V"
return d
def proceed(self):
@@ -87,4 +88,19 @@ class BIM_Shape2DView(gui_shape2dview.Shape2DView):
self.finish()
class BIM_Shape2DCut(BIM_Shape2DView):
def GetResources(self):
d = super().GetResources()
d["Pixmap"] = "Arch_View_Cut"
d["MenuText"] = QT_TRANSLATE_NOOP("BIM_Shape2DView", "Section cut")
d['Accel'] = "V, C"
return d
def proceed(self):
super().proceed()
FreeCADGui.doCommand("sv.ProjectionMode = \"Cutfaces\"")
FreeCADGui.addCommand("BIM_Shape2DView", BIM_Shape2DView())
FreeCADGui.addCommand("BIM_Shape2DCut", BIM_Shape2DCut())
+2 -1
View File
@@ -36,11 +36,12 @@ translate = FreeCAD.Qt.translate
class BIM_TDPage:
def GetResources(self):
return {
"Pixmap": "techdraw-PageDefault",
"Pixmap": "BIM_PageDefault",
"MenuText": QT_TRANSLATE_NOOP("BIM_TDPage", "Page"),
"ToolTip": QT_TRANSLATE_NOOP(
"BIM_TDPage", "Creates a new TechDraw page from a template"
),
'Accel': "V, P",
}
def IsActive(self):
+4 -3
View File
@@ -35,12 +35,13 @@ translate = FreeCAD.Qt.translate
class BIM_TDView:
def GetResources(self):
return {
"Pixmap": "techdraw-ArchView",
"MenuText": QT_TRANSLATE_NOOP("BIM_TDView", "View"),
"Pixmap": "BIM_InsertView",
"MenuText": QT_TRANSLATE_NOOP("BIM_TDView", "Insert view"),
"ToolTip": QT_TRANSLATE_NOOP(
"BIM_TDView",
"Creates a TechDraw view from a section plane or 2D objects",
"Inserts a drawing view on a page",
),
'Accel': "V, I",
}
def IsActive(self):
+48 -4
View File
@@ -73,6 +73,7 @@ class BIM_Views:
self.dialog = FreeCADGui.PySideUic.loadUi(":/ui/dialogViews.ui")
vm.setWidget(self.dialog)
vm.tree = self.dialog.tree
vm.viewtree = self.dialog.viewtree
vm.closeEvent = self.onClose
# set context menu
@@ -121,6 +122,7 @@ class BIM_Views:
self.dialog.buttonRename.triggered.connect(self.rename)
self.dialog.tree.itemClicked.connect(self.select)
self.dialog.tree.itemDoubleClicked.connect(show)
self.dialog.viewtree.itemDoubleClicked.connect(show)
self.dialog.tree.itemChanged.connect(self.editObject)
self.dialog.tree.customContextMenuRequested.connect(self.onContextMenu)
# delay connecting after FreeCAD finishes setting up
@@ -177,13 +179,12 @@ class BIM_Views:
"updates the view manager"
from PySide import QtCore, QtGui
import Draft
vm = findWidget()
if vm and FreeCAD.ActiveDocument:
if vm.isVisible() and (vm.tree.state() != vm.tree.State.EditingState):
vm.tree.clear()
import Draft
treeViewItems = [] # QTreeWidgetItem to Display in tree
lvHold = []
soloProxyHold = []
@@ -260,6 +261,9 @@ class BIM_Views:
treeViewItems = treeViewItems + sortLvItems + soloProxyHold
vm.tree.addTopLevelItems(treeViewItems)
if vm.isVisible() and (vm.viewtree.state() != vm.viewtree.State.EditingState):
vm.viewtree.clear()
# add views
ficon = QtGui.QIcon.fromTheme("folder", QtGui.QIcon(":/icons/folder.svg"))
views = self.getViews()
@@ -273,7 +277,7 @@ class BIM_Views:
i.setIcon(0, v.ViewObject.Icon)
i.setToolTip(0, v.Name)
top.addChild(i)
vm.tree.addTopLevelItem(top)
vm.viewtree.addTopLevelItem(top)
# add pages
pages = self.getPages()
@@ -286,7 +290,7 @@ class BIM_Views:
i.setIcon(0, p.ViewObject.Icon)
i.setToolTip(0, p.Name)
top.addChild(i)
vm.tree.addTopLevelItem(top)
vm.viewtree.addTopLevelItem(top)
# set TreeVinew Item selected if obj is selected
objSelected = FreeCADGui.Selection.getSelection()
@@ -306,6 +310,7 @@ class BIM_Views:
# expand
vm.tree.expandAll()
vm.viewtree.expandAll()
def select(self, item, column=None):
"selects a doc object corresponding to an item"
@@ -445,11 +450,16 @@ class BIM_Views:
def getViews(self):
"""Returns a list of 2D views"""
import Draft
views = []
for p in self.getPages():
for v in p.Views:
if getattr(v, "Source", None):
views.append(v.Source)
bps = [o for o in FreeCAD.ActiveDocument.Objects if Draft.getType(o) == "BuildingPart"]
for v in [o for o in bps if isView(o)]:
if v not in views:
views.append(v)
return views
def getPages(self):
@@ -475,6 +485,8 @@ def findWidget():
def show(item, column=None):
"item has been double-clicked"
import Draft
obj = None
vm = findWidget()
if isinstance(item, str) or (
@@ -495,6 +507,7 @@ def show(item, column=None):
if obj:
FreeCADGui.Selection.clearSelection()
FreeCADGui.Selection.addSelection(obj)
vparam = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")
if obj.isDerivedFrom("TechDraw::DrawPage"):
# case 1: the object is a TD page. We switch to it simply
@@ -519,10 +532,35 @@ def show(item, column=None):
FreeCADGui.ActiveDocument.ActiveView.viewTop()
FreeCADGui.Selection.clearSelection()
FreeCADGui.Selection.addSelection(obj)
if PARAMS.GetBool("BimViewsSwitchBackground", False):
vparam.SetBool("Simple", True)
vparam.SetBool("Gradient", False)
vparam.SetBool("RadialGradient", False)
else:
# case 3: This is maybe a BuildingPart. Place the WP on it
FreeCADGui.runCommand("Draft_SelectPlane")
if PARAMS.GetBool("BimViewsSwitchBackground", False):
vparam.SetBool("Simple", False)
vparam.SetBool("Gradient", False)
vparam.SetBool("RadialGradient", True)
if Draft.getType(obj) == "BuildingPart":
if obj.IfcType == "Building Storey":
# hide all other storeys
obj.ViewObject.Visibility = True
bldgs = [o for o in obj.InList if Draft.getType(o) == "BuildingPart" and o.IfcType == "Building"]
if len(bldgs) == 1:
bldg = bldgs[0]
storeys = [o for o in bldg.OutList if Draft.getType(o) == "BuildingPart" and o.IfcType == "Building Storey"]
for storey in storeys:
if storey != obj:
storey.ViewObject.Visibility = False
elif obj.IfcType == "Building":
# show all storeys
storeys = [o for o in obj.OutList if Draft.getType(o) == "BuildingPart" and o.IfcType == "Building Storey"]
for storey in storeys:
storey.ViewObject.Visibility = True
if vm:
# store the last double-clicked item for the BIM WPView command
if isinstance(item, str) or (
@@ -543,6 +581,12 @@ def isView(obj):
return True
if getattr(obj,"DrawingView",False):
return True
if getattr(obj, "IfcType", None) == "Annotation":
if getattr(obj, "ObjectType", "").upper() == "DRAWING":
return True
if getattr(obj, "Class", None) == "IfcAnnotation":
if getattr(obj, "ObjectType", "").upper() == "DRAWING":
return True
return False