mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Fix bug in covering/space tool with matrix global and local
This commit is contained in:
committed by
Massimo Fabbro
parent
25df2f6414
commit
f1ab02b311
@@ -131,7 +131,7 @@ class CoveringToolUI:
|
|||||||
elif (element and
|
elif (element and
|
||||||
bpy.context.selected_objects and
|
bpy.context.selected_objects and
|
||||||
element.is_a("IfcCovering") and
|
element.is_a("IfcCovering") and
|
||||||
AuthoringData.data["predefined_type"] == "FLOORING" and
|
# AuthoringData.data["predefined_type"] == "FLOORING" and
|
||||||
AuthoringData.data["active_material_usage"] == "LAYER3"):
|
AuthoringData.data["active_material_usage"] == "LAYER3"):
|
||||||
row = cls.layout.row(align=True)
|
row = cls.layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ def regen_selected_flooring_object(ifc, spatial, model, Type, geometry):
|
|||||||
|
|
||||||
name = "Aux"
|
name = "Aux"
|
||||||
mesh = spatial.get_named_mesh_from_bmesh(name = name, bmesh = bm)
|
mesh = spatial.get_named_mesh_from_bmesh(name = name, bmesh = bm)
|
||||||
|
mesh = spatial.get_transformed_mesh_from_local_to_global(mesh)
|
||||||
obj = spatial.get_named_obj_from_mesh(name, mesh)
|
obj = spatial.get_named_obj_from_mesh(name, mesh)
|
||||||
|
|
||||||
points = spatial.get_2d_vertices_from_obj(obj)
|
points = spatial.get_2d_vertices_from_obj(obj)
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ def generate_space(ifc, spatial, model, Type):
|
|||||||
mesh = spatial.get_named_mesh_from_bmesh(name = "Space", bmesh = bm)
|
mesh = spatial.get_named_mesh_from_bmesh(name = "Space", bmesh = bm)
|
||||||
|
|
||||||
if element and element.is_a("IfcSpace"):
|
if element and element.is_a("IfcSpace"):
|
||||||
|
mesh = spatial.get_transformed_mesh_from_local_to_global(mesh)
|
||||||
spatial.edit_active_space_obj_from_mesh(mesh)
|
spatial.edit_active_space_obj_from_mesh(mesh)
|
||||||
else:
|
else:
|
||||||
if relating_type:
|
if relating_type:
|
||||||
|
|||||||
@@ -828,6 +828,7 @@ class Spatial:
|
|||||||
def get_named_obj_from_bmesh(cls, name, bmesh): pass
|
def get_named_obj_from_bmesh(cls, name, bmesh): pass
|
||||||
def get_named_obj_from_mesh(cls, name, mesh): pass
|
def get_named_obj_from_mesh(cls, name, mesh): pass
|
||||||
def get_named_mesh_from_bmesh(cls, name, bmesh): pass
|
def get_named_mesh_from_bmesh(cls, name, bmesh): pass
|
||||||
|
def get_transformed_mesh_from_local_to_global(cls, mesh): pass
|
||||||
def edit_active_space_obj_from_mesh(cls, mesh): pass
|
def edit_active_space_obj_from_mesh(cls, mesh): pass
|
||||||
def set_obj_origin_to_bboxcenter(cls, obj): pass
|
def set_obj_origin_to_bboxcenter(cls, obj): pass
|
||||||
def set_obj_origin_to_cursor_position(cls, obj): pass
|
def set_obj_origin_to_cursor_position(cls, obj): pass
|
||||||
|
|||||||
@@ -485,11 +485,7 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_bmesh_from_polygon(cls, poly, h):
|
def get_bmesh_from_polygon(cls, poly, h):
|
||||||
if bpy.context.selected_objects and bpy.context.active_object:
|
mat = Matrix()
|
||||||
mat = bpy.context.active_object.matrix_world
|
|
||||||
else:
|
|
||||||
mat = Matrix()
|
|
||||||
|
|
||||||
bm = bmesh.new()
|
bm = bmesh.new()
|
||||||
bm.verts.index_update()
|
bm.verts.index_update()
|
||||||
bm.edges.index_update()
|
bm.edges.index_update()
|
||||||
@@ -534,6 +530,15 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
bmesh.free()
|
bmesh.free()
|
||||||
return mesh
|
return mesh
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_transformed_mesh_from_local_to_global(cls, mesh):
|
||||||
|
active_obj = cls.get_active_obj()
|
||||||
|
element = tool.Ifc.get_entity(active_obj)
|
||||||
|
mat = active_obj.matrix_world
|
||||||
|
mesh.transform(mat.inverted())
|
||||||
|
mesh.update()
|
||||||
|
return mesh
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def edit_active_space_obj_from_mesh(cls, mesh):
|
def edit_active_space_obj_from_mesh(cls, mesh):
|
||||||
active_obj = bpy.context.active_object
|
active_obj = bpy.context.active_object
|
||||||
|
|||||||
Reference in New Issue
Block a user