Arch: Housecleaning - Moving IFC getPreferences() to helper module
This commit is contained in:
@@ -143,48 +143,8 @@ structuralifcobjects = (
|
||||
"IfcStructuralPlanarAction"
|
||||
)
|
||||
|
||||
|
||||
def getPreferences():
|
||||
"""Retrieve the IFC preferences available in import and export.
|
||||
|
||||
MERGE_MODE_ARCH:
|
||||
0 = parametric arch objects
|
||||
1 = non-parametric arch objects
|
||||
2 = Part shapes
|
||||
3 = One compound per storey
|
||||
"""
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
||||
if FreeCAD.GuiUp and p.GetBool("ifcShowDialog", False):
|
||||
Gui.showPreferences("Import-Export", 0)
|
||||
|
||||
preferences = {
|
||||
'DEBUG': p.GetBool("ifcDebug", False),
|
||||
'PREFIX_NUMBERS': p.GetBool("ifcPrefixNumbers", False),
|
||||
'SKIP': p.GetString("ifcSkip", "").split(","),
|
||||
'SEPARATE_OPENINGS': p.GetBool("ifcSeparateOpenings", False),
|
||||
'ROOT_ELEMENT': p.GetString("ifcRootElement", "IfcProduct"),
|
||||
'GET_EXTRUSIONS': p.GetBool("ifcGetExtrusions", False),
|
||||
'MERGE_MATERIALS': p.GetBool("ifcMergeMaterials", False),
|
||||
'MERGE_MODE_ARCH': p.GetInt("ifcImportModeArch", 0),
|
||||
'MERGE_MODE_STRUCT': p.GetInt("ifcImportModeStruct", 1),
|
||||
'CREATE_CLONES': p.GetBool("ifcCreateClones", True),
|
||||
'IMPORT_PROPERTIES': p.GetBool("ifcImportProperties", False),
|
||||
'SPLIT_LAYERS': p.GetBool("ifcSplitLayers", False), # wall layer, not layer for visual props
|
||||
'FITVIEW_ONIMPORT': p.GetBool("ifcFitViewOnImport", False),
|
||||
'ALLOW_INVALID': p.GetBool("ifcAllowInvalid", False),
|
||||
'REPLACE_PROJECT': p.GetBool("ifcReplaceProject", False),
|
||||
'MULTICORE': p.GetInt("ifcMulticore", 0),
|
||||
'IMPORT_LAYER': p.GetBool("ifcImportLayer", True)
|
||||
}
|
||||
|
||||
if preferences['MERGE_MODE_ARCH'] > 0:
|
||||
preferences['SEPARATE_OPENINGS'] = False
|
||||
preferences['GET_EXTRUSIONS'] = False
|
||||
if not preferences['SEPARATE_OPENINGS']:
|
||||
preferences['SKIP'].append("IfcOpeningElement")
|
||||
|
||||
return preferences
|
||||
# backwards compatibility
|
||||
getPreferences = importIFCHelper.getPreferences
|
||||
|
||||
|
||||
def export(exportList, filename, colors=None, preferences=None):
|
||||
@@ -255,7 +215,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
starttime = time.time() # in seconds
|
||||
|
||||
if preferences is None:
|
||||
preferences = getPreferences()
|
||||
preferences = importIFCHelper.getPreferences()
|
||||
|
||||
if preferences["MULTICORE"] and not hasattr(srcfile, "by_guid"):
|
||||
return importIFCmulticore.insert(srcfile, docname, preferences)
|
||||
|
||||
@@ -80,6 +80,49 @@ def dms2dd(degrees, minutes, seconds, milliseconds=0):
|
||||
return dd
|
||||
|
||||
|
||||
def getPreferences():
|
||||
"""Retrieve the IFC preferences available in import and export.
|
||||
|
||||
MERGE_MODE_ARCH:
|
||||
0 = parametric arch objects
|
||||
1 = non-parametric arch objects
|
||||
2 = Part shapes
|
||||
3 = One compound per storey
|
||||
"""
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
||||
if FreeCAD.GuiUp and p.GetBool("ifcShowDialog", False):
|
||||
Gui.showPreferences("Import-Export", 0)
|
||||
|
||||
preferences = {
|
||||
'DEBUG': p.GetBool("ifcDebug", False),
|
||||
'PREFIX_NUMBERS': p.GetBool("ifcPrefixNumbers", False),
|
||||
'SKIP': p.GetString("ifcSkip", "").split(","),
|
||||
'SEPARATE_OPENINGS': p.GetBool("ifcSeparateOpenings", False),
|
||||
'ROOT_ELEMENT': p.GetString("ifcRootElement", "IfcProduct"),
|
||||
'GET_EXTRUSIONS': p.GetBool("ifcGetExtrusions", False),
|
||||
'MERGE_MATERIALS': p.GetBool("ifcMergeMaterials", False),
|
||||
'MERGE_MODE_ARCH': p.GetInt("ifcImportModeArch", 0),
|
||||
'MERGE_MODE_STRUCT': p.GetInt("ifcImportModeStruct", 1),
|
||||
'CREATE_CLONES': p.GetBool("ifcCreateClones", True),
|
||||
'IMPORT_PROPERTIES': p.GetBool("ifcImportProperties", False),
|
||||
'SPLIT_LAYERS': p.GetBool("ifcSplitLayers", False), # wall layer, not layer for visual props
|
||||
'FITVIEW_ONIMPORT': p.GetBool("ifcFitViewOnImport", False),
|
||||
'ALLOW_INVALID': p.GetBool("ifcAllowInvalid", False),
|
||||
'REPLACE_PROJECT': p.GetBool("ifcReplaceProject", False),
|
||||
'MULTICORE': p.GetInt("ifcMulticore", 0),
|
||||
'IMPORT_LAYER': p.GetBool("ifcImportLayer", True)
|
||||
}
|
||||
|
||||
if preferences['MERGE_MODE_ARCH'] > 0:
|
||||
preferences['SEPARATE_OPENINGS'] = False
|
||||
preferences['GET_EXTRUSIONS'] = False
|
||||
if not preferences['SEPARATE_OPENINGS']:
|
||||
preferences['SKIP'].append("IfcOpeningElement")
|
||||
|
||||
return preferences
|
||||
|
||||
|
||||
class ProjectImporter:
|
||||
"""A helper class to create an Arch Project object."""
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import os
|
||||
import FreeCAD
|
||||
import Draft
|
||||
import Arch
|
||||
import importIFC
|
||||
import importIFCHelper
|
||||
from FreeCAD import Base
|
||||
import ArchIFC
|
||||
@@ -77,7 +76,7 @@ def insert(filename,docname=None,preferences=None):
|
||||
|
||||
# setup ifcopenshell
|
||||
if not preferences:
|
||||
preferences = importIFC.getPreferences()
|
||||
preferences = importIFCHelper.getPreferences()
|
||||
settings = ifcopenshell.geom.settings()
|
||||
settings.set(settings.USE_BREP_DATA,True)
|
||||
settings.set(settings.SEW_SHELLS,True)
|
||||
|
||||
Reference in New Issue
Block a user