mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
Allow graceful migration of IFC entities when exporting so the user doesn't need to fix every invalid schema attribute themselves3RlG$Bayj3kPlwh4EEvXJP
This commit is contained in:
@@ -1885,11 +1885,7 @@ class IfcExporter:
|
|||||||
try:
|
try:
|
||||||
product["ifc"] = self.file.create_entity(product["class"], **product["attributes"])
|
product["ifc"] = self.file.create_entity(product["class"], **product["attributes"])
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
self.ifc_export_settings.logger.error(
|
product["ifc"] = self.create_ifc_entity(product)
|
||||||
'The type product "{}/{}" could not be created: {}'.format(
|
|
||||||
product["class"], product["attributes"]["Name"], e.args
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def add_predefined_attributes_to_type_product(self, product, attributes):
|
def add_predefined_attributes_to_type_product(self, product, attributes):
|
||||||
self.create_predefined_attributes(attributes)
|
self.create_predefined_attributes(attributes)
|
||||||
@@ -2073,7 +2069,7 @@ class IfcExporter:
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def create_styled_item(self, styled_item, representation_item=None):
|
def create_styled_item(self, styled_item, representation_item=None):
|
||||||
surface_style = self.ifc_parser.surface_styles[styled_item["attributes"]["Name"]]
|
surface_style = self.ifc_parser.surface_styles[styled_item["raw"].name]
|
||||||
if not surface_style["ifc"]:
|
if not surface_style["ifc"]:
|
||||||
styles = []
|
styles = []
|
||||||
styles.append(self.create_surface_style_rendering(styled_item))
|
styles.append(self.create_surface_style_rendering(styled_item))
|
||||||
@@ -2302,11 +2298,20 @@ class IfcExporter:
|
|||||||
try:
|
try:
|
||||||
product["ifc"] = self.file.create_entity(product["class"], **product["attributes"])
|
product["ifc"] = self.file.create_entity(product["class"], **product["attributes"])
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
self.ifc_export_settings.logger.error(
|
product["ifc"] = self.create_ifc_entity(product)
|
||||||
'The product "{}/{}" could not be created: {}'.format(
|
|
||||||
product["class"], product["attributes"]["Name"], e.args
|
def create_ifc_entity(self, data):
|
||||||
|
result = self.file.create_entity(data["class"])
|
||||||
|
for key, value in data["attributes"].items():
|
||||||
|
try:
|
||||||
|
setattr(result, key, value)
|
||||||
|
except RuntimeError as e:
|
||||||
|
self.ifc_export_settings.logger.error(
|
||||||
|
'The entity "{}/{}" attribute {} with value {} could not be created: {}'.format(
|
||||||
|
data["class"], data["attributes"]["Name"], key, value, e.args
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
return result
|
||||||
|
|
||||||
def get_product_attribute_type(self, product_class, attribute_name):
|
def get_product_attribute_type(self, product_class, attribute_name):
|
||||||
element_schema = schema.ifc.elements[product_class]
|
element_schema = schema.ifc.elements[product_class]
|
||||||
|
|||||||
@@ -4118,7 +4118,6 @@ class ActivateDrawingStyle(bpy.types.Operator):
|
|||||||
space.overlay.show_axis_z = style["space.overlay.show_axis_z"]
|
space.overlay.show_axis_z = style["space.overlay.show_axis_z"]
|
||||||
space.overlay.show_object_origins = style["space.overlay.show_object_origins"]
|
space.overlay.show_object_origins = style["space.overlay.show_object_origins"]
|
||||||
space.overlay.show_relationship_lines = style["space.overlay.show_relationship_lines"]
|
space.overlay.show_relationship_lines = style["space.overlay.show_relationship_lines"]
|
||||||
space.shading.type = "RENDERED"
|
|
||||||
|
|
||||||
def set_query(self):
|
def set_query(self):
|
||||||
self.selector = ifcopenshell.util.selector.Selector()
|
self.selector = ifcopenshell.util.selector.Selector()
|
||||||
|
|||||||
Reference in New Issue
Block a user