Skip to content

Commit

Permalink
Arch: Added a pref option to export everything as Brep in IFC files
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Mar 27, 2014
1 parent e429b31 commit 4f008b3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Mod/Arch/Arch_rc.py

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/Mod/Arch/Resources/ui/archprefs-import.ui
Expand Up @@ -266,6 +266,26 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="Gui::PrefCheckBox" name="checkBox">
<property name="toolTip">
<string>Some IFC viewers don't like objects exported as extrusions. Use this to force all objects to be exported as BREP geometry.</string>
</property>
<property name="text">
<string>Force export as Breps</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ifcExportAsBrep</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down
8 changes: 7 additions & 1 deletion src/Mod/Arch/importIFC.py
Expand Up @@ -898,6 +898,7 @@ def export(exportList,filename):
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
scaling = p.GetFloat("IfcScalingFactor",1.0)
exporttxt = p.GetBool("IfcExportList",False)
forcebrep = p.GetBool("ifcExportAsBrep",False)
application = "FreeCAD"
ver = FreeCAD.Version()
version = ver[0]+"."+ver[1]+" build"+ver[2]
Expand Down Expand Up @@ -930,9 +931,13 @@ def export(exportList,filename):
otype = Draft.getType(obj)
name = str(obj.Label)
parent = Arch.getHost(obj)
gdata = Arch.getExtrusionData(obj,scaling)
gdata = None
if not forcebrep:
gdata = Arch.getExtrusionData(obj,scaling)
if DEBUG: print "extrusion data for ",obj.Label," : ",gdata
if not gdata:
fdata = Arch.getBrepFacesData(obj,scaling)
if DEBUG: print "brep data for ",obj.Label," : ",fdata
if not fdata:
if obj.isDerivedFrom("Part::Feature"):
print "IFC export: error retrieving the shape of object ", obj.Name
Expand Down Expand Up @@ -978,6 +983,7 @@ def export(exportList,filename):
elif obj.Role == "Foundation":
role = "IfcFooting"
if gdata:
#ifc.addStructure( role, ifc.addExtrudedPolyline(gdata[0],gdata[1]), storey=parent, name=name )
if FreeCAD.Vector(gdata[1]).getAngle(FreeCAD.Vector(0,0,1)) < .01:
# Workaround for non-Z extrusions, apparently not supported by ifc++ TODO: fix this
ifc.addStructure( role, ifc.addExtrudedPolyline(gdata[0],gdata[1]), storey=parent, name=name )
Expand Down

0 comments on commit 4f008b3

Please sign in to comment.