mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 21:12:07 +00:00
Rework python pset module (#1221)
New features ============ * Handle all syntax for ApplicableEntity as defined in IFC documentation. (drawback it increase request time by ~2/3) * Allow to get applicable psets directly from template definition without caching. This allow more general purpose usages. (drawback it increase request time by ~2.4) To notice / discuss =================== * `ifcwrap/CmakeLists` was installing only `.py` and `.bnf` files from `ifcopenshell-python`. Why ? It now copy all files. Is it an issue ? * property template file is now stored in ifcopenshell python module to allow usage from every softwares. It was before only available for blenderbim addon. * psets and qtos are now optionnally cached at object instead of module level. This allow to work with multiple schema in the same python interpreter. (eg. might help conversion between schemas) * in blenderbim addon psetqto are now stored in `schema.psetqto`.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.pset
|
||||
from pathlib import Path
|
||||
from . import export_ifc
|
||||
from . import schema
|
||||
@@ -433,9 +432,7 @@ def getPsetNames(self, context):
|
||||
global psetnames_enum
|
||||
psetnames_enum.clear()
|
||||
if "/" in context.active_object.name and context.active_object.name.split("/")[0] in schema.ifc.elements:
|
||||
pset_names = ifcopenshell.util.pset.get_applicable_psetqtos(
|
||||
bpy.context.scene.BIMProperties.export_schema, context.active_object.name.split("/")[0], is_pset=True
|
||||
)
|
||||
pset_names = schema.ifc.psetqto.get_applicable_names(context.active_object.name.split("/")[0], pset_only=True)
|
||||
psetnames_enum.extend([(p, p, "") for p in pset_names])
|
||||
return psetnames_enum
|
||||
|
||||
@@ -443,9 +440,7 @@ def getPsetNames(self, context):
|
||||
def getMaterialPsetNames(self, context):
|
||||
global materialpsetnames_enum
|
||||
materialpsetnames_enum.clear()
|
||||
pset_names = ifcopenshell.util.pset.get_applicable_psetqtos(
|
||||
bpy.context.scene.BIMProperties.export_schema, "IfcMaterial", is_pset=True
|
||||
)
|
||||
pset_names = schema.ifc.psetqto.get_applicable_names("IfcMaterial", pset_only=True)
|
||||
materialpsetnames_enum.extend([(p, p, "") for p in pset_names])
|
||||
return materialpsetnames_enum
|
||||
|
||||
@@ -454,9 +449,7 @@ def getQtoNames(self, context):
|
||||
global qtonames_enum
|
||||
qtonames_enum.clear()
|
||||
if "/" in context.active_object.name and context.active_object.name.split("/")[0] in schema.ifc.elements:
|
||||
qto_names = ifcopenshell.util.pset.get_applicable_psetqtos(
|
||||
bpy.context.scene.BIMProperties.export_schema, context.active_object.name.split("/")[0], is_qto=True
|
||||
)
|
||||
qto_names = schema.ifc.psetqto.get_applicable_names(context.active_object.name.split("/")[0], qto_only=True)
|
||||
qtonames_enum.extend([(q, q, "") for q in qto_names])
|
||||
return qtonames_enum
|
||||
|
||||
|
||||
Reference in New Issue
Block a user