@@ -441,6 +441,7 @@ def _execute(self, context):
441441 x_angle = 0 if tool .Cad .is_x (self .x_angle , pi , tolerance = 0.001 ) else self .x_angle
442442 unit_scale = ifcopenshell .util .unit .calculate_unit_scale (tool .Ifc .get ())
443443 selected_objs = tool .Model .get_selected_mesh_ifc_objects ()
444+ shape_builder = ifcopenshell .util .shape_builder .ShapeBuilder (tool .Ifc .get ())
444445
445446 for obj in selected_objs :
446447 element = tool .Ifc .get_entity (obj )
@@ -466,16 +467,11 @@ def _execute(self, context):
466467 existing_x_angle = obj .rotation_euler .x
467468 existing_x_angle = 0 if tool .Cad .is_x (existing_x_angle , 0 , tolerance = 0.001 ) else existing_x_angle
468469 existing_x_angle = 0 if tool .Cad .is_x (existing_x_angle , pi , tolerance = 0.001 ) else existing_x_angle
469- # Reset the transformation and returns to the original points with 0 degrees
470- extrusion .SweptArea .OuterCurve .Points .CoordList = [
471- (p [0 ], p [1 ] * abs (cos (existing_x_angle )))
472- for p in extrusion .SweptArea .OuterCurve .Points .CoordList
473- ]
474-
475- # Apply the transformation for the new x_angle
476- extrusion .SweptArea .OuterCurve .Points .CoordList = [
477- (p [0 ], p [1 ] * abs (1 / cos (x_angle ))) for p in extrusion .SweptArea .OuterCurve .Points .CoordList
478- ]
470+
471+ coord_list = shape_builder .get_polyline_coords (extrusion .SweptArea .OuterCurve )
472+ coord_list = [(p [0 ], p [1 ] * abs (cos (existing_x_angle ))) for p in coord_list ] # Reset the transformation and returns to the original points with 0 degrees
473+ coord_list = [(p [0 ], p [1 ] * abs (1 / cos (x_angle ))) for p in coord_list ] # Apply the transformation for the new x_angle
474+ shape_builder .set_polyline_coords (extrusion .SweptArea .OuterCurve , coord_list )
479475
480476 # The extrusion direction calculated previously default to the positive direction
481477 # Here we set the extrusion direction to negative if that's the case
0 commit comments