Arch: Added pref option to IFC import to treat materials with same name as one
This commit is contained in:
parent
9431d301d3
commit
691b1af944
|
@ -186,6 +186,26 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBox_3">
|
||||
<property name="toolTip">
|
||||
<string>If several materials with the same name are found in the IFC file, they will be treated as one.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Merge materials with same name</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ifcMergeMaterials</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Arch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
|
|
|
@ -274,6 +274,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
|||
SEPARATE_OPENINGS = p.GetBool("ifcSeparateOpenings",False)
|
||||
ROOT_ELEMENT = p.GetString("ifcRootElement","IfcProduct")
|
||||
GET_EXTRUSIONS = p.GetBool("ifcGetExtrusions",False)
|
||||
MERGE_MATERIALS = p.GetBool("ifcMergeMaterials",False)
|
||||
if root:
|
||||
ROOT_ELEMENT = root
|
||||
MERGE_MODE = p.GetInt("ifcImportMode",0)
|
||||
|
@ -340,7 +341,15 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
|||
properties.setdefault(obj.id(),[]).extend([e.id() for e in r.RelatingPropertyDefinition.HasProperties])
|
||||
for r in ifcfile.by_type("IfcRelAssociatesMaterial"):
|
||||
for o in r.RelatedObjects:
|
||||
mattable[o.id()] = r.RelatingMaterial.id()
|
||||
if MERGE_MATERIALS:
|
||||
for k,v in mattable.items():
|
||||
if ifcfile[v].Name == r.RelatingMaterial.Name:
|
||||
mattable[o.id()] = v
|
||||
break
|
||||
else:
|
||||
mattable[o.id()] = r.RelatingMaterial.id()
|
||||
else:
|
||||
mattable[o.id()] = r.RelatingMaterial.id()
|
||||
for r in ifcfile.by_type("IfcStyledItem"):
|
||||
if r.Styles[0].is_a("IfcPresentationStyleAssignment"):
|
||||
if r.Styles[0].Styles[0].is_a("IfcSurfaceStyle"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user