mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Covering Tool: fixed bug if the project is defined in units different from SI units
This commit is contained in:
committed by
Massimo Fabbro
parent
50bbe849ff
commit
cf65612a96
@@ -50,6 +50,7 @@ def add_instance_flooring_covering_from_cursor(ifc, spatial, model, Type, geomet
|
||||
# spatial.traslate_obj_to_z_location(obj, z)
|
||||
spatial.link_obj_to_active_collection(obj)
|
||||
points = spatial.get_2d_vertices_from_obj(obj)
|
||||
points = spatial.get_scaled_2d_vertices(points)
|
||||
spatial.assign_type_to_obj(obj)
|
||||
|
||||
spatial.assign_swept_area_outer_curve_from_2d_vertices(obj, vertices = points)
|
||||
@@ -91,6 +92,7 @@ def add_instance_ceiling_covering_from_cursor(ifc, spatial, model, Type, geometr
|
||||
spatial.traslate_obj_to_z_location(obj, z)
|
||||
spatial.link_obj_to_active_collection(obj)
|
||||
points = spatial.get_2d_vertices_from_obj(obj)
|
||||
points = spatial.get_scaled_2d_vertices(points)
|
||||
spatial.assign_type_to_obj(obj)
|
||||
|
||||
spatial.assign_swept_area_outer_curve_from_2d_vertices(obj, vertices = points)
|
||||
@@ -119,6 +121,7 @@ def regen_selected_covering_object(ifc, spatial, model, Type, geometry):
|
||||
obj = spatial.get_named_obj_from_mesh(name, mesh)
|
||||
|
||||
points = spatial.get_2d_vertices_from_obj(obj)
|
||||
points = spatial.get_scaled_2d_vertices(points)
|
||||
|
||||
spatial.assign_swept_area_outer_curve_from_2d_vertices(active_obj, vertices = points)
|
||||
body = spatial.get_body_representation(active_obj)
|
||||
@@ -140,6 +143,7 @@ def add_instance_flooring_coverings_from_walls(ifc, spatial, collector, geometry
|
||||
spatial.link_obj_to_active_collection(obj)
|
||||
|
||||
points = spatial.get_2d_vertices_from_obj(obj)
|
||||
points = spatial.get_scaled_2d_vertices(points)
|
||||
|
||||
spatial.assign_type_to_obj(obj)
|
||||
spatial.assign_container_to_obj(obj)
|
||||
@@ -163,6 +167,7 @@ def add_instance_ceiling_coverings_from_walls(ifc, spatial, collector, geometry,
|
||||
spatial.link_obj_to_active_collection(obj)
|
||||
|
||||
points = spatial.get_2d_vertices_from_obj(obj)
|
||||
points = spatial.get_scaled_2d_vertices(points)
|
||||
|
||||
spatial.assign_type_to_obj(obj)
|
||||
spatial.assign_container_to_obj(obj)
|
||||
|
||||
@@ -843,6 +843,7 @@ class Spatial:
|
||||
def traslate_obj_to_z_location(cls, obj): pass
|
||||
def link_obj_to_active_collection(cls, obj): pass
|
||||
def get_2d_vertices_from_obj(cls, obj): pass
|
||||
def get_scaled_2d_vertices(cls, points): pass
|
||||
def assign_swept_area_outer_curve_from_2d_vertices(cls, obj, vertices): pass
|
||||
def get_body_representation(cls, obj): pass
|
||||
def assign_ifcspace_class_to_obj(cls, obj): pass
|
||||
|
||||
@@ -627,6 +627,18 @@ class Spatial(blenderbim.core.tool.Spatial):
|
||||
points.append((vectors[0][0], vectors[0][1]))
|
||||
return points
|
||||
|
||||
@classmethod
|
||||
def get_scaled_2d_vertices(cls, points):
|
||||
model = tool.Ifc.get()
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(model)
|
||||
for i in range(len(points)):
|
||||
a = list(points[i])
|
||||
a[0]/=unit_scale
|
||||
a[1]/=unit_scale
|
||||
points[i] = tuple(a)
|
||||
|
||||
return points
|
||||
|
||||
@classmethod
|
||||
def assign_swept_area_outer_curve_from_2d_vertices(cls, obj, vertices):
|
||||
body = cls.get_body_representation(obj)
|
||||
|
||||
Reference in New Issue
Block a user