Arch: misc improvements and bugfixes

* Allow mesh-based windows (with non-solid shape) to pass through
* Allow precast elements to be clones
* Structure elements now display a different icon when thry are clones
* Arch clones now get the same placements as their cloned object on create
* Fixed the bad export of clones to IFC
* Recoded the Site/Building/Floor IFC export to be more flexible
This commit is contained in:
Yorik van Havre 2016-06-15 21:17:44 -03:00
parent 89ebf5fbcc
commit 4acf8e09dc
8 changed files with 402 additions and 28 deletions

View File

@ -645,7 +645,7 @@ class Component:
print "Arch: unable to cut object ",o.Name, " from ", obj.Name
return base
def applyShape(self,obj,shape,placement):
def applyShape(self,obj,shape,placement,allowinvalid=False,allownosolid=False):
"checks and cleans the given shape, and apply it to the object"
if shape:
if not shape.isNull():
@ -662,8 +662,16 @@ class Component:
obj.Placement = placement
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has no solid")+"\n")
if allownosolid:
obj.Shape = shape
if not placement.isNull():
obj.Placement = placement
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has an invalid shape")+"\n")
if allowinvalid:
obj.Shape = shape
if not placement.isNull():
obj.Placement = placement
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has a null shape")+"\n")

View File

@ -52,6 +52,11 @@ class _Precast(ArchComponent.Component):
def getExtrusionVector(self,obj,noplacement=True):
return FreeCAD.Vector()
def execute(self,obj):
if self.clone(obj):
return
class _PrecastBeam(_Precast):
@ -68,6 +73,9 @@ class _PrecastBeam(_Precast):
obj.Role = ["Beam"]
def execute(self,obj):
if self.clone(obj):
return
pl = obj.Placement
length = obj.Length.Value
@ -168,6 +176,9 @@ class _PrecastIbeam(_Precast):
obj.Role = ["Beam"]
def execute(self,obj):
if self.clone(obj):
return
pl = obj.Placement
length = obj.Length.Value
@ -220,6 +231,9 @@ class _PrecastPillar(_Precast):
obj.Role = ["Column"]
def execute(self,obj):
if self.clone(obj):
return
pl = obj.Placement
length = obj.Length.Value
@ -336,6 +350,9 @@ class _PrecastPanel(_Precast):
obj.Role = ["Plate"]
def execute(self,obj):
if self.clone(obj):
return
pl = obj.Placement
length = obj.Length.Value
@ -432,6 +449,9 @@ class _PrecastSlab(_Precast):
obj.SlabType = ["Champagne","Hat"]
def execute(self,obj):
if self.clone(obj):
return
pl = obj.Placement
slabtype = obj.SlabType
@ -514,6 +534,9 @@ class _ViewProviderPrecast(ArchComponent.ViewProviderComponent):
def getIcon(self):
import Arch_rc
if hasattr(self,"Object"):
if self.Object.CloneOf:
return ":/icons/Arch_Structure_Clone.svg"
return ":/icons/Arch_Structure_Tree.svg"
def setEdit(self,vobj,mode):
@ -535,8 +558,8 @@ class _ViewProviderPrecast(ArchComponent.ViewProviderComponent):
import FreeCADGui
if hasattr(self,"dentd"):
self.Object.Dents = self.dentd.getValues()
del self.dentd
FreeCADGui.Control.closeDialog()
del self.dentd
return False
@ -1042,7 +1065,7 @@ class _DentsTaskPanel:
return l
def makePrecast(precasttype,length=0,width=0,height=0,slabtype="",chamfer=0,dentlength=0,dentwidth=0,dentheight=0,dents=[],base=0,holenumber=0,holemajor=0,holeminor=0,holespacing=0,groovenumber=0,groovedepth=0,grooveheight=0,groovespacing=0):
def makePrecast(precasttype=None,length=0,width=0,height=0,slabtype="",chamfer=0,dentlength=0,dentwidth=0,dentheight=0,dents=[],base=0,holenumber=0,holemajor=0,holeminor=0,holespacing=0,groovenumber=0,groovedepth=0,grooveheight=0,groovespacing=0):
"creates one of the precast objects in the current document"

View File

@ -504,6 +504,9 @@ class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
def getIcon(self):
import Arch_rc
if hasattr(self,"Object"):
if self.Object.CloneOf:
return ":/icons/Arch_Structure_Clone.svg"
return ":/icons/Arch_Structure_Tree.svg"
def updateData(self,obj,prop):

View File

@ -716,8 +716,7 @@ class _Window(ArchComponent.Component):
base = self.processSubShapes(obj,base)
if base:
if not base.isNull():
if base.Solids:
self.applyShape(obj,base,pl)
self.applyShape(obj,base,pl,allowinvalid=True,allownosolid=True)
def getSubVolume(self,obj,plac=None):
"returns a subvolume for cutting in a base object"
@ -746,7 +745,10 @@ class _Window(ArchComponent.Component):
width = max(b.XLength,b.YLength,b.ZLength)
if not width:
if Draft.isClone(obj,"Window"):
orig = obj.Objects[0]
if hasattr(obj,"CloneOf"):
orig = obj.CloneOf
else:
orig = obj.Objects[0]
if orig.Base:
base = orig.Base
if hasattr(orig,"HoleDepth"):

View File

@ -21,6 +21,7 @@
<file>icons/Arch_SectionPlane_Tree.svg</file>
<file>icons/Arch_Site_Tree.svg</file>
<file>icons/Arch_Structure_Tree.svg</file>
<file>icons/Arch_Structure_Clone.svg</file>
<file>icons/Arch_Window_Tree.svg</file>
<file>icons/Arch_Axis.svg</file>
<file>icons/Arch_Axis_Tree.svg</file>

View File

@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="Arch_Structure_Clone.svg">
<defs
id="defs2987">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-56.67589 : 60.541728 : 1"
inkscape:vp_y="0 : 1102.1522 : 0"
inkscape:vp_z="125.67018 : 63.747989 : 1"
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
id="perspective2993" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-56.67589 : 60.541728 : 1"
inkscape:vp_y="0 : 1102.1522 : 0"
inkscape:vp_z="125.67018 : 63.747989 : 1"
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
id="perspective2993-4" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-46.892514 : 61.217294 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="95.652941 : 64.126385 : 1"
inkscape:persp3d-origin="26.74385 : 38.914263 : 1"
id="perspective2993-7" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-49.818182 : 58.545455 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="92.727273 : 61.454546 : 1"
inkscape:persp3d-origin="23.818182 : 36.242424 : 1"
id="perspective2993-3" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-56.67589 : 60.541728 : 1"
inkscape:vp_y="0 : 1102.1522 : 0"
inkscape:vp_z="125.67018 : 63.747989 : 1"
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
id="perspective2993-9" />
<linearGradient
id="linearGradient3860">
<stop
id="stop3862"
offset="0"
style="stop-color:#003e8d;stop-opacity:1" />
<stop
id="stop3864"
offset="1"
style="stop-color:#66bbff;stop-opacity:1" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1,0,0,0.96889279,-1.5,1.0452469)"
gradientUnits="userSpaceOnUse"
y2="12.160761"
x2="30.113636"
y1="61.410763"
x1="31.125395"
id="linearGradient3866"
xlink:href="#linearGradient3860"
inkscape:collect="always" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="12.160761"
x2="30.113636"
y1="61.410763"
x1="31.125395"
id="linearGradient3866-5"
xlink:href="#linearGradient3860-6"
inkscape:collect="always" />
<linearGradient
id="linearGradient3860-6">
<stop
id="stop3862-4"
offset="0"
style="stop-color:#5a9ff5;stop-opacity:1;" />
<stop
id="stop3864-4"
offset="1"
style="stop-color:#ffffff;stop-opacity:1;" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.9445437"
inkscape:cx="53.289931"
inkscape:cy="-11.076704"
inkscape:current-layer="layer1-3"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1053"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
inkscape:connector-curvature="0"
id="path3919"
style="color:#000000;fill:#afafde;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 13.798146,54.963468 9.388498,6.861485 8.53344,-5.12696 -9.62057,-5.794341 z" />
<path
inkscape:connector-curvature="0"
id="path3921"
style="color:#000000;fill:#353564;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 13.798146,23.375496 0,31.587972 8.301368,-4.059816 0,-29.244015 z" />
<path
inkscape:connector-curvature="0"
id="path3923"
style="color:#000000;fill:#e9e9ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 22.099514,21.659637 9.62057,2.222871 0,32.815485 -9.62057,-5.794341 z" />
<path
inkscape:connector-curvature="0"
id="path3925"
style="color:#000000;fill:#774901;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 13.798146,23.375496 9.388498,2.653358 8.53344,-2.146346 -9.62057,-2.222871 z" />
<path
inkscape:connector-curvature="0"
id="path3927"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 23.186644,26.028854 0,35.796099 8.53344,-5.12696 0,-32.815485 z" />
<path
inkscape:connector-curvature="0"
id="path3929"
style="color:#000000;fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 13.798146,23.375496 9.388498,2.653358 0,35.796099 -9.388498,-6.861485 z" />
<path
inkscape:connector-curvature="0"
id="path3939"
style="color:#000000;fill:#afafde;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 37.056572,48.22511 9.388501,4.483969 8.482949,-5.616787 -9.162177,-3.582156 z" />
<path
inkscape:connector-curvature="0"
id="path3941"
style="color:#000000;fill:#353564;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 37.056572,18.674277 0,29.550833 8.709273,-4.714974 0,-26.646468 z" />
<path
inkscape:connector-curvature="0"
id="path3943"
style="color:#000000;fill:#e9e9ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 45.765845,16.863668 9.162177,1.198951 0,29.029673 -9.162177,-3.582156 z" />
<path
inkscape:connector-curvature="0"
id="path3945"
style="color:#000000;fill:#774901;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 37.056572,18.674277 9.388501,1.524077 8.482949,-2.135735 -9.162177,-1.198951 z" />
<path
inkscape:connector-curvature="0"
id="path3947"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 46.445073,20.198354 0,32.510725 8.482949,-5.616787 0,-29.029673 z" />
<path
inkscape:connector-curvature="0"
id="path3949"
style="color:#000000;fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 37.056572,18.674277 9.388501,1.524077 0,32.510725 -9.388501,-4.483969 z" />
<path
inkscape:connector-curvature="0"
id="path3899"
style="color:#000000;fill:#afafde;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="M 2.8666854,22.255584 12.487769,25.292915 61.908304,14.358929 52.014367,13.449446 z" />
<path
inkscape:connector-curvature="0"
id="path3901"
style="color:#000000;fill:#353564;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 2.8666854,6.2707377 0,15.9848463 49.1476816,-8.806138 0,-9.5874872 z" />
<path
inkscape:connector-curvature="0"
id="path3903"
style="color:#000000;fill:#e9e9ff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 52.014367,3.8619588 9.893937,0.036747 0,10.4602232 -9.893937,-0.909483 z" />
<path
inkscape:connector-curvature="0"
id="path3905"
style="color:#000000;fill:#4d4d9f;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="M 2.8666854,6.2707377 12.487769,6.7251851 61.908304,3.8987059 52.014367,3.8619588 z" />
<path
inkscape:connector-curvature="0"
id="path3907"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 12.487769,6.7251851 0,18.5677299 49.420535,-10.933986 0,-10.4602231 z" />
<path
inkscape:connector-curvature="0"
id="path3909"
style="color:#000000;fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible"
d="m 2.8666854,6.2707377 9.6210836,0.4544474 0,18.5677299 -9.6210836,-3.037331 z" />
<g
inkscape:label="Layer 1"
id="layer1-3"
transform="matrix(0.54817793,0,0,0.54817793,1.3122798,29.079894)"
style="stroke-width:5.4726758;stroke-miterlimit:4;stroke-dasharray:none">
<path
sodipodi:nodetypes="csscssscssscsscc"
inkscape:connector-curvature="0"
d="m 27.954545,56.184055 c 0,0 2,-0.176162 -4,2.466272 -6,2.642435 -10.318182,-1.321216 -12.5,-2.99476 C 9.33773,54.031884 7.8181813,50.282617 7.7727273,47.375939 5.5909091,47.023613 3.0454545,41.738744 4.1363636,39.096309 5.2272727,36.453875 8.681818,35.220738 10.318182,29.935868 c 1.636363,-5.28487 1.272727,-14.269148 1.636363,-15.678446 0.363637,-1.4093 2.181819,-11.8028765 19.41497,-11.8028762 17.233152,2e-7 19.051334,10.3935772 19.414971,11.8028772 0.363636,1.409298 0,10.393576 1.636363,15.678446 1.636364,5.28487 5.090909,6.518007 6.181818,9.160441 1.09091,2.642435 -1.454545,7.927304 -3.636363,8.27963 -0.04545,2.906678 -1.565003,6.655945 -3.681818,8.279628 -2.181818,1.673544 -6.5,5.637195 -12.5,2.99476 -6,-2.642434 -4,-2.466272 -4,-2.466272 z"
style="fill:url(#linearGradient3866);fill-opacity:1;stroke:#000000;stroke-width:5.4726758;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path3004-1" />
<path
inkscape:connector-curvature="0"
id="path3794"
d="M 14.570609,23.068836 27.55566,22.570573 c 0,0 -0.514259,2.740444 -3.728381,4.608927 -3.214121,1.868484 -6.299678,1.743918 -6.299678,1.743918 0,0 -0.77139,-0.249131 -1.928473,-2.615877 -1.157084,-2.366746 -1.028519,-3.238705 -1.028519,-3.238705 z"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path3794-0"
d="M 47.55141,23.068836 34.566359,22.570573 c 0,0 0.514259,2.740444 3.728381,4.608927 3.214121,1.868484 6.299678,1.743918 6.299678,1.743918 0,0 0.77139,-0.249131 1.928473,-2.615877 1.157084,-2.366746 1.028519,-3.238705 1.028519,-3.238705 z"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cssscsssc"
inkscape:connector-curvature="0"
id="path3814"
d="m 17.141906,44.244984 c 0,0 3.406969,-1.121091 5.978266,-3.363271 2.571298,-2.24218 3.406969,-4.982623 7.778175,-4.982623 4.371205,0 5.27116,3.051856 8.356716,5.543168 2.985945,2.410884 5.656855,2.802726 5.656855,2.802726 0,0 -4.178359,0.622828 -7.135351,-1.121091 -2.956991,-1.743917 -2.571297,-4.048381 -6.813937,-3.923816 -4.242641,0.124566 -4.949747,2.67816 -8.035304,3.923816 -3.085557,1.245657 -5.78542,1.121091 -5.78542,1.121091 z"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path3816"
d="m 11.904233,31.329198 3.14619,3.832344 -2.409091,3.170922 c 0,0 -0.590909,-1.101014 -0.681819,-2.818597 -0.09091,-1.717583 -0.05528,-4.184669 -0.05528,-4.184669 z"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:transform-center-x="-1.5454545"
inkscape:connector-curvature="0"
id="path3816-2"
d="m 49.402211,29.670811 -3.14619,3.832344 2.409091,3.170922 c 0,0 0.590909,-1.101014 0.681819,-2.818597 0.09091,-1.717583 0.05528,-4.184669 0.05528,-4.184669 z"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
transform="matrix(1,0,0,0.96889279,0.1363636,-0.54021403)"
id="path3836"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.85327804;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
cx="20.227272"
cy="55.409092"
r="2.0454545" />
<circle
transform="matrix(1,0,0,0.96889279,21.636364,-0.93658032)"
id="path3836-8"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.85327804;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
cx="20.227272"
cy="55.409092"
r="2.0454545" />
<path
sodipodi:nodetypes="cssscc"
inkscape:connector-curvature="0"
id="path3856"
d="m 28.136364,56.184055 c 0,0 -2.272728,0 -2.272728,-2.202029 0,-2.20203 1.911635,-6.469935 4.722705,-6.429925 3.130346,0.04456 4.786987,4.139814 4.877896,6.429925 0.09091,2.29011 -1.873328,2.378191 -1.873328,2.378191 z"
style="fill:#565656;fill-opacity:1;stroke:#000000;stroke-width:1.82422519;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path3858"
d="m 8.929825,20.406247 c 0,0 13.081475,-1.712777 22.804193,-1.370221 9.722719,0.342555 21.389981,1.541499 21.389981,1.541499"
style="fill:none;stroke:#000000;stroke-width:1.82422519;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1116,32 +1116,75 @@ def export(exportList,filename):
sites = []
buildings = []
floors = []
treated = []
for floor in Draft.getObjectsOfType(objectslist,"Floor"):
objs = Draft.getGroupContents(floor,walls=True)
objs = Arch.pruneIncluded(objs)
children = []
for c in objs:
if c.Name in products.keys():
if not (c.Name in treated):
children.append(products[c.Name])
f = products[floor.Name]
if children:
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'StoreyLink','',children,f)
floors.append(floor.Name)
for c in children:
if not (c.Name in treated):
treated.append(c.Name)
for building in Draft.getObjectsOfType(objectslist,"Building"):
objs = Draft.getGroupContents(building,walls=True)
objs = Arch.pruneIncluded(objs)
children = []
childfloors = []
for c in objs:
if c.Name in products.keys():
if Draft.getType(c) == "Floor":
childfloors.append(products[c.Name])
elif not (c.Name in treated):
children.append(products[c.Name])
b = products[building.Name]
if children:
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',children,b)
if childfloors:
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',b,childfloors)
buildings.append(b)
for c in children+childfloors:
if not (c.Name in treated):
treated.append(c.Name)
for site in Draft.getObjectsOfType(objectslist,"Site"):
for building in Draft.getObjectsOfType(site.Group,"Building"):
for floor in Draft.getObjectsOfType(building.Group,"Floor"):
children = Draft.getGroupContents(floor,walls=True)
children = Arch.pruneIncluded(children)
children = [products[c.Name] for c in children if c.Name in products.keys()]
floor = products[floor.Name]
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'StoreyLink','',children,floor)
floors.append(floor)
building = products[building.Name]
if floors:
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',building,floors)
buildings.append(building)
site = products[site.Name]
if buildings:
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'SiteLink','',site,buildings)
sites.append(site)
objs = Draft.getGroupContents(site,walls=True)
objs = Arch.pruneIncluded(objs)
children = []
childbuildings = []
for c in objs:
if c.Name in products.keys():
if Draft.getType(c) == "Building":
childbuildings.append(products[c.Name])
elif not (c.Name in treated):
children.append(products[c.Name])
s = products[site.Name]
if children:
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',children,s)
sites.append(s)
for c in children+childbuildings:
if not (c.Name in treated):
treated.append(c.Name)
if not sites:
if DEBUG: print "adding default site"
if DEBUG: print "No site found. Adding default site"
sites = [ifcfile.createIfcSite(ifcopenshell.guid.compress(uuid.uuid1().hex),history,"Default Site",'',None,None,None,None,"ELEMENT",None,None,None,None,None)]
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'ProjectLink','',project,sites)
if not buildings:
if DEBUG: print "adding default building"
if DEBUG: print "No building found. Adding default building"
buildings = [ifcfile.createIfcBuilding(ifcopenshell.guid.compress(uuid.uuid1().hex),history,"Default Building",'',None,None,None,None,"ELEMENT",None,None,None)]
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'SiteLink','',sites[0],buildings)
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',products.values(),buildings[0])
ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'SiteLink','',sites[0],buildings)
untreated = []
for p in products.values():
if not(p.Name) in treated:
if p.Name != buildings[0].Name:
untreated.append(p)
if untreated:
ifcfile.createIfcRelContainedInSpatialStructure(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'BuildingLink','',untreated,buildings[0])
# materials
materials = {}
@ -1383,6 +1426,11 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
dataset = fcshape.Shells
if DEBUG: print "Warning! object contains no solids"
# if this is a clone, place back the shapes in null position
if tostore:
for shape in dataset:
shape.Placement = FreeCAD.Placement()
# new ifcopenshell serializer
from ifcopenshell import geom
if hasattr(geom,"serialise") and obj.isDerivedFrom("Part::Feature") and SERIALIZE:
@ -1477,7 +1525,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
ovc = ifcfile.createIfcCartesianPoint((0.0,0.0,0.0))
gpl = ifcfile.createIfcAxis2Placement3D(ovc,zvc,xvc)
repmap = ifcfile.createIfcRepresentationMap(gpl,subrep)
pla = FreeCAD.ActiveDocument.getObject(k).Placement
pla = FreeCAD.ActiveDocument.getObject(tostore).Placement
axis1 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(1,0,0))))
axis2 = ifcfile.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(0,1,0))))
origin = ifcfile.createIfcCartesianPoint(tuple(FreeCAD.Vector(pla.Base).multiply(0.001)))
@ -1485,7 +1533,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
transf = ifcfile.createIfcCartesianTransformationOperator3D(axis1,axis2,origin,1.0,axis3)
mapitem = ifcfile.createIfcMappedItem(repmap,transf)
shapes = [mapitem]
sharedobjects[k] = repmap
sharedobjects[tostore] = repmap
solidType = "MappedRepresentation"
# set surface style

View File

@ -2477,6 +2477,7 @@ def clone(obj,delta=None):
base = getCloneBase(obj[0])
cl.Label = prefix + base.Label
cl.CloneOf = base
cl.Placement = obj[0].Placement
return cl
else:
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")