Arch: Added scaling in IFC importer

This commit is contained in:
Yorik van Havre 2014-08-01 21:44:46 -03:00
parent a548203ca9
commit 2d8963de03
3 changed files with 20 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -116,21 +116,15 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>IFC export</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="toolTip">
<string>A scaling factor to apply to imported IFC objects</string>
</property>
<property name="text"> <property name="text">
<string>Scaling factor (also used for import)</string> <string>Scaling factor</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -158,6 +152,15 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>IFC export</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
@ -186,7 +189,7 @@
<string>Some IFC viewers don't like objects exported as extrusions. Use this to force all objects to be exported as BREP geometry.</string> <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>
<property name="text"> <property name="text">
<string>Force export as Breps</string> <string>Force export as Brep</string>
</property> </property>
<property name="prefEntry" stdset="0"> <property name="prefEntry" stdset="0">
<cstring>ifcExportAsBrep</cstring> <cstring>ifcExportAsBrep</cstring>

View File

@ -126,6 +126,7 @@ def insert(filename,docname,skip=[]):
PREFIX_NUMBERS = p.GetBool("ifcPrefixNumbers",False) PREFIX_NUMBERS = p.GetBool("ifcPrefixNumbers",False)
SKIP = p.GetString("ifcSkip","") SKIP = p.GetString("ifcSkip","")
SEPARATE_OPENINGS = p.GetBool("ifcSeparateOpenings",False) SEPARATE_OPENINGS = p.GetBool("ifcSeparateOpenings",False)
SCALE = p.GetFloat("IfcScalingFactor",1.0)
if DEBUG: print "opening ",filename,"..." if DEBUG: print "opening ",filename,"..."
try: try:
@ -174,6 +175,8 @@ def insert(filename,docname,skip=[]):
if brep: if brep:
shape = Part.Shape() shape = Part.Shape()
shape.importBrepFromString(brep) shape.importBrepFromString(brep)
if SCALE != 1:
shape.scale(SCALE)
if not shape.isNull(): if not shape.isNull():
baseobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name+"_body") baseobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name+"_body")
baseobj.Shape = shape baseobj.Shape = shape