mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
See #4652. Fix bug where auto-detection of a false origin could be incorrect
We were incorrectly multiplying a shape matrix in SI units with a vertex in project units. We also didn't do a final check whether or not that final resultant coordinate was far away or not (for example, origin and vertex can cancel each other out)
This commit is contained in:
@@ -702,15 +702,17 @@ class IfcImporter:
|
|||||||
mat = np.array(
|
mat = np.array(
|
||||||
([m[0], m[3], m[6], m[9]], [m[1], m[4], m[7], m[10]], [m[2], m[5], m[8], m[11]], [0, 0, 0, 1])
|
([m[0], m[3], m[6], m[9]], [m[1], m[4], m[7], m[10]], [m[2], m[5], m[8], m[11]], [0, 0, 0, 1])
|
||||||
)
|
)
|
||||||
point = np.array(
|
point = mat @ np.array(
|
||||||
(
|
(
|
||||||
shape.geometry.verts[0] / self.unit_scale,
|
shape.geometry.verts[0],
|
||||||
shape.geometry.verts[1] / self.unit_scale,
|
shape.geometry.verts[1],
|
||||||
shape.geometry.verts[2] / self.unit_scale,
|
shape.geometry.verts[2],
|
||||||
0.0,
|
0.0,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return mat @ point
|
point = point / self.unit_scale
|
||||||
|
if self.is_point_far_away(point, is_meters=False):
|
||||||
|
return point
|
||||||
|
|
||||||
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:
|
||||||
@@ -1500,10 +1502,9 @@ class IfcImporter:
|
|||||||
project_collection = bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
|
project_collection = bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
|
||||||
types_collection = project_collection.children[self.type_collection.name]
|
types_collection = project_collection.children[self.type_collection.name]
|
||||||
types_collection.hide_viewport = False
|
types_collection.hide_viewport = False
|
||||||
for obj in types_collection.collection.objects: #turn off all objects inside Types collection.
|
for obj in types_collection.collection.objects: # turn off all objects inside Types collection.
|
||||||
obj.hide_set(True)
|
obj.hide_set(True)
|
||||||
|
|
||||||
|
|
||||||
def clean_mesh(self):
|
def clean_mesh(self):
|
||||||
obj = None
|
obj = None
|
||||||
last_obj = None
|
last_obj = None
|
||||||
|
|||||||
Reference in New Issue
Block a user