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>
</layout>
</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>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>A scaling factor to apply to imported IFC objects</string>
</property>
<property name="text">
<string>Scaling factor (also used for import)</string>
<string>Scaling factor</string>
</property>
</widget>
</item>
@ -158,6 +152,15 @@
</item>
</layout>
</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>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<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>
</property>
<property name="text">
<string>Force export as Breps</string>
<string>Force export as Brep</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ifcExportAsBrep</cstring>

View File

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