Arch: IFC import, add pref to view fit while importing
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>456</width>
|
||||
<height>699</height>
|
||||
<height>728</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -358,6 +358,26 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBox_14">
|
||||
<property name="toolTip">
|
||||
<string>Fit view during import on the imported objects. This will slow down the import, but one can watch the import.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit view while importing</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ifcFitViewOnImport</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Arch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -139,7 +139,7 @@ def getPreferences():
|
||||
global ROOT_ELEMENT, GET_EXTRUSIONS, MERGE_MATERIALS
|
||||
global MERGE_MODE_ARCH, MERGE_MODE_STRUCT, CREATE_CLONES
|
||||
global FORCE_BREP, IMPORT_PROPERTIES, STORE_UID, SERIALIZE
|
||||
global SPLIT_LAYERS, EXPORT_2D, FULL_PARAMETRIC
|
||||
global SPLIT_LAYERS, EXPORT_2D, FULL_PARAMETRIC, FITVIEW_ONIMPORT
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
if FreeCAD.GuiUp and p.GetBool("ifcShowDialog",False):
|
||||
import FreeCADGui
|
||||
@@ -166,6 +166,7 @@ def getPreferences():
|
||||
SPLIT_LAYERS = p.GetBool("ifcSplitLayers",False)
|
||||
EXPORT_2D = p.GetBool("ifcExport2D",True)
|
||||
FULL_PARAMETRIC = p.GetBool("IfcExportFreeCADProperties",False)
|
||||
FITVIEW_ONIMPORT = p.GetBool("ifcFitViewOnImport",False)
|
||||
|
||||
|
||||
def explore(filename=None):
|
||||
@@ -381,6 +382,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||
openings = ifcfile.by_type("IfcOpeningElement")
|
||||
annotations = ifcfile.by_type("IfcAnnotation")
|
||||
materials = ifcfile.by_type("IfcMaterial")
|
||||
overallboundbox = FreeCAD.BoundBox()
|
||||
|
||||
if DEBUG: print("Building relationships table...",end="")
|
||||
|
||||
@@ -473,6 +475,10 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||
progressbar.start("Importing IFC objects...",len(products))
|
||||
if DEBUG: print("Processing objects...")
|
||||
|
||||
if FITVIEW_ONIMPORT and FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
FreeCADGui.ActiveDocument.activeView().viewAxonometric()
|
||||
|
||||
# products
|
||||
for product in products:
|
||||
|
||||
@@ -563,6 +569,14 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||
|
||||
shape.scale(1000.0) # IfcOpenShell always outputs in meters
|
||||
|
||||
if FITVIEW_ONIMPORT and FreeCAD.GuiUp:
|
||||
try:
|
||||
if not overallboundbox.isInside(shape.BoundBox):
|
||||
FreeCADGui.SendMsgToActiveView("ViewFit")
|
||||
overallboundbox.add(shape.BoundBox)
|
||||
except:
|
||||
pass
|
||||
|
||||
if not shape.isNull():
|
||||
if (MERGE_MODE_ARCH > 0 and archobj) or structobj:
|
||||
if ptype == "IfcSpace": # do not add spaces to compounds
|
||||
|
||||
Reference in New Issue
Block a user