Skip to content

Commit

Permalink
Arch: Added option to allow import of invalid IFC geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Oct 21, 2019
1 parent 1c981e8 commit 7767103
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/Mod/Arch/Resources/ui/preferences-ifc.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>883</height>
<height>910</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -305,6 +305,22 @@ they will be treated as one.</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_22">
<property name="toolTip">
<string>IFC files can contain unclean or non-solid geometry. If this option is checked, all the geometry is imported, regardless of their validity.</string>
</property>
<property name="text">
<string>Allow invalid shapes</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ifcAllowInvalid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
Expand Down
7 changes: 4 additions & 3 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -162,7 +162,8 @@ def getPreferences():
'CREATE_CLONES': p.GetBool("ifcCreateClones",True),
'IMPORT_PROPERTIES': p.GetBool("ifcImportProperties",False),
'SPLIT_LAYERS': p.GetBool("ifcSplitLayers",False),
'FITVIEW_ONIMPORT': p.GetBool("ifcFitViewOnImport",False)
'FITVIEW_ONIMPORT': p.GetBool("ifcFitViewOnImport",False),
'ALLOW_INVALID': p.GetBool("ifcAllowInvalid",False)
}

if preferences['MERGE_MODE_ARCH'] > 0:
Expand Down Expand Up @@ -403,9 +404,9 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
shape.importBrepFromString(brep,False)
shape.scale(1000.0) # IfcOpenShell always outputs in meters, we convert to mm, the freecad internal unit

if shape.isNull():
if shape.isNull() and (not preferences['ALLOW_INVALID']):
if preferences['DEBUG']: print("null shape ",end="")
elif not shape.isValid():
elif not shape.isValid() and (not preferences['ALLOW_INVALID']):
if preferences['DEBUG']: print("invalid shape ",end="")
else:

Expand Down

0 comments on commit 7767103

Please sign in to comment.