mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
bonsai, ifcopenshell - append IfcSurfaceStyles from other projects
And other IfcPresentationStyles, though they are not currently supported by bonsai. Example - https://imgur.com/a/AHlvowp
This commit is contained in:
@@ -25,7 +25,18 @@ import ifcopenshell.api.owner.settings
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.geolocation
|
||||
import ifcopenshell.util.placement
|
||||
from typing import Optional, Any, Union
|
||||
from typing import Optional, Any, Union, Literal, get_args
|
||||
|
||||
|
||||
APPENDABLE_ASSET = Literal[
|
||||
"IfcTypeProduct",
|
||||
"IfcProduct",
|
||||
"IfcMaterial",
|
||||
"IfcCostSchedule",
|
||||
"IfcProfileDef",
|
||||
"IfcPresentationStyle",
|
||||
]
|
||||
APPENDABLE_ASSET_TYPES = get_args(APPENDABLE_ASSET)
|
||||
|
||||
|
||||
def append_asset(
|
||||
@@ -154,6 +165,9 @@ class Usecase:
|
||||
elif self.settings["element"].is_a("IfcProfileDef"):
|
||||
self.target_class = "IfcProfileDef"
|
||||
return self.append_profile_def()
|
||||
elif self.settings["element"].is_a("IfcPresentationStyle"):
|
||||
self.target_class = "IfcPresentationStyle"
|
||||
return self.append_presentation_style()
|
||||
|
||||
def get_existing_element(self, element):
|
||||
if element.id() in self.added_elements:
|
||||
@@ -186,6 +200,10 @@ class Usecase:
|
||||
self.whitelisted_inverse_attributes = {"IfcProfileDef": ["HasProperties"]}
|
||||
return self.add_element(self.settings["element"])
|
||||
|
||||
def append_presentation_style(self):
|
||||
self.whitelisted_inverse_attributes = {}
|
||||
return self.add_element(self.settings["element"])
|
||||
|
||||
def append_type_product(self):
|
||||
self.whitelisted_inverse_attributes = {
|
||||
"IfcObjectDefinition": ["HasAssociations"],
|
||||
|
||||
Reference in New Issue
Block a user