Fix issue where sometimes world coordinate system would trigger the georeferencing distance threshold

This commit is contained in:
Dion Moult
2022-11-09 18:37:04 +11:00
parent 2cbc7a10ab
commit 67808b8384
+16 -9
View File
@@ -112,7 +112,7 @@ class MaterialCreator:
def parse_representation(self, representation): def parse_representation(self, representation):
has_parsed = False has_parsed = False
representation_items = self.resolve_all_representation_items(representation) representation_items = self.resolve_all_stylable_representation_items(representation)
for item in representation_items: for item in representation_items:
if self.parse_representation_item(item): if self.parse_representation_item(item):
has_parsed = True has_parsed = True
@@ -153,7 +153,7 @@ class MaterialCreator:
] ]
self.mesh.polygons.foreach_set("material_index", material_index) self.mesh.polygons.foreach_set("material_index", material_index)
def resolve_all_representation_items(self, representation): def resolve_all_stylable_representation_items(self, representation):
items = [] items = []
for item in representation.Items: for item in representation.Items:
if item.is_a("IfcMappedItem"): if item.is_a("IfcMappedItem"):
@@ -528,14 +528,21 @@ class IfcImporter:
def does_element_likely_have_geometry_far_away(self, element): def does_element_likely_have_geometry_far_away(self, element):
for representation in element.Representation.Representations: for representation in element.Representation.Representations:
for subelement in self.file.traverse(representation): items = []
if subelement.is_a("IfcCartesianPointList3D"): for item in representation.Items:
for point in subelement.CoordList: if item.is_a("IfcMappedItem"):
if len(point) == 3 and self.is_point_far_away(point, is_meters=False): items.extend(item.MappingSource.MappedRepresentation.Items)
else:
items.append(item)
for item in items:
for subelement in self.file.traverse(item):
if subelement.is_a("IfcCartesianPointList3D"):
for point in subelement.CoordList:
if len(point) == 3 and self.is_point_far_away(point, is_meters=False):
return True
if subelement.is_a("IfcCartesianPoint"):
if len(subelement.Coordinates) == 3 and self.is_point_far_away(subelement, is_meters=False):
return True return True
if subelement.is_a("IfcCartesianPoint"):
if len(subelement.Coordinates) == 3 and self.is_point_far_away(subelement, is_meters=False):
return True
def apply_blender_offset_to_matrix_world(self, obj, matrix): def apply_blender_offset_to_matrix_world(self, obj, matrix):
props = bpy.context.scene.BIMGeoreferenceProperties props = bpy.context.scene.BIMGeoreferenceProperties