Skip to content

Commit

Permalink
See #4652. Fix bug where auto-detection of a false origin could be in…
Browse files Browse the repository at this point in the history
…correct

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)
  • Loading branch information
Moult committed May 10, 2024
1 parent cd6eac3 commit e7eb00e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/blenderbim/blenderbim/bim/import_ifc.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,17 @@ def get_offset_point(self):
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])
)
point = np.array(
point = mat @ np.array(
(
shape.geometry.verts[0] / self.unit_scale,
shape.geometry.verts[1] / self.unit_scale,
shape.geometry.verts[2] / self.unit_scale,
shape.geometry.verts[0],
shape.geometry.verts[1],
shape.geometry.verts[2],
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):
for representation in element.Representation.Representations:
Expand Down Expand Up @@ -1500,10 +1502,9 @@ def add_project_to_scene(self):
project_collection = bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
types_collection = project_collection.children[self.type_collection.name]
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)


def clean_mesh(self):
obj = None
last_obj = None
Expand Down

0 comments on commit e7eb00e

Please sign in to comment.