mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-13 06:53:36 +00:00
Bug fix on polyline model decorator when there is no polyline yet.
This commit is contained in:
@@ -705,11 +705,11 @@ class PolylineDecorator:
|
|||||||
|
|
||||||
# Create polyline with selected points
|
# Create polyline with selected points
|
||||||
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline
|
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline
|
||||||
if not polyline_data:
|
if polyline_data:
|
||||||
return
|
|
||||||
else:
|
|
||||||
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline[0]
|
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline[0]
|
||||||
polyline_points = polyline_data.polyline_points
|
polyline_points = polyline_data.polyline_points
|
||||||
|
else:
|
||||||
|
polyline_points = []
|
||||||
polyline_verts = []
|
polyline_verts = []
|
||||||
polyline_edges = []
|
polyline_edges = []
|
||||||
for point_prop in polyline_points:
|
for point_prop in polyline_points:
|
||||||
@@ -739,7 +739,7 @@ class PolylineDecorator:
|
|||||||
self.draw_batch("LINES", [self.axis_start, self.axis_end], axis_color, [(0, 1)])
|
self.draw_batch("LINES", [self.axis_start, self.axis_end], axis_color, [(0, 1)])
|
||||||
|
|
||||||
# Lines for X, Y, Z of single measure
|
# Lines for X, Y, Z of single measure
|
||||||
if polyline_data.measurement_type == "SINGLE":
|
if polyline_data and polyline_data.measurement_type == "SINGLE":
|
||||||
axis, _ = self.calculate_measurement_x_y_and_z(context)
|
axis, _ = self.calculate_measurement_x_y_and_z(context)
|
||||||
x_axis, y_axis, z_axis = axis
|
x_axis, y_axis, z_axis = axis
|
||||||
self.draw_batch("LINES", [*x_axis], decorator_color_x_axis, [(0, 1)])
|
self.draw_batch("LINES", [*x_axis], decorator_color_x_axis, [(0, 1)])
|
||||||
@@ -747,11 +747,12 @@ class PolylineDecorator:
|
|||||||
self.draw_batch("LINES", [*z_axis], decorator_color_z_axis, [(0, 1)])
|
self.draw_batch("LINES", [*z_axis], decorator_color_z_axis, [(0, 1)])
|
||||||
|
|
||||||
# Area highlight
|
# Area highlight
|
||||||
_, area = tool.Polyline.validate_input(polyline_data.area, "AREA")
|
if polyline_data:
|
||||||
if area:
|
_, area = tool.Polyline.validate_input(polyline_data.area, "AREA")
|
||||||
if float(area) > 0:
|
if area:
|
||||||
tris = self.calculate_polygon(polyline_verts)
|
if float(area) > 0:
|
||||||
self.draw_batch("TRIS", polyline_verts, transparent_color(decorator_color_special), tris)
|
tris = self.calculate_polygon(polyline_verts)
|
||||||
|
self.draw_batch("TRIS", polyline_verts, transparent_color(decorator_color_special), tris)
|
||||||
|
|
||||||
# Mouse points
|
# Mouse points
|
||||||
if snap_prop.snap_type in ["Plane", "Axis", "Mix"]:
|
if snap_prop.snap_type in ["Plane", "Axis", "Mix"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user