mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Small fix in model decorator
This commit is contained in:
@@ -636,62 +636,65 @@ class PolylineDecorator:
|
|||||||
# Plane Method or Default Container
|
# Plane Method or Default Container
|
||||||
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||||
projection_point = []
|
projection_point = []
|
||||||
if self.tool_state.plane_method:
|
if not self.tool_state:
|
||||||
plane_origin = self.tool_state.plane_origin
|
pass
|
||||||
axis1 = None
|
else:
|
||||||
axis2 = None
|
if self.tool_state.plane_method:
|
||||||
if self.tool_state.plane_method == "XY":
|
plane_origin = self.tool_state.plane_origin
|
||||||
projection_point = [Vector((snap_prop.x, snap_prop.y, self.tool_state.plane_origin.z))]
|
axis1 = None
|
||||||
axis1 = [
|
axis2 = None
|
||||||
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
if self.tool_state.plane_method == "XY":
|
||||||
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
projection_point = [Vector((snap_prop.x, snap_prop.y, self.tool_state.plane_origin.z))]
|
||||||
]
|
axis1 = [
|
||||||
axis2 = [
|
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y + 100000, plane_origin.z),
|
]
|
||||||
]
|
axis2 = [
|
||||||
axis_color1 = decorator_color_x_axis
|
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
||||||
axis_color2 = decorator_color_y_axis
|
(plane_origin.x, plane_origin.y + 100000, plane_origin.z),
|
||||||
elif self.tool_state.plane_method == "XZ":
|
]
|
||||||
projection_point = [Vector((snap_prop.x, self.tool_state.plane_origin.y, snap_prop.z))]
|
axis_color1 = decorator_color_x_axis
|
||||||
axis1 = [
|
axis_color2 = decorator_color_y_axis
|
||||||
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
elif self.tool_state.plane_method == "XZ":
|
||||||
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
projection_point = [Vector((snap_prop.x, self.tool_state.plane_origin.y, snap_prop.z))]
|
||||||
]
|
axis1 = [
|
||||||
axis2 = [
|
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
]
|
||||||
]
|
axis2 = [
|
||||||
axis_color1 = decorator_color_x_axis
|
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
||||||
axis_color2 = decorator_color_z_axis
|
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
||||||
elif self.tool_state.plane_method == "YZ":
|
]
|
||||||
projection_point = [Vector((self.tool_state.plane_origin.x, snap_prop.y, snap_prop.z))]
|
axis_color1 = decorator_color_x_axis
|
||||||
axis1 = [
|
axis_color2 = decorator_color_z_axis
|
||||||
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
elif self.tool_state.plane_method == "YZ":
|
||||||
(plane_origin.x, plane_origin.y + 10000, plane_origin.z),
|
projection_point = [Vector((self.tool_state.plane_origin.x, snap_prop.y, snap_prop.z))]
|
||||||
]
|
axis1 = [
|
||||||
axis2 = [
|
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
(plane_origin.x, plane_origin.y + 10000, plane_origin.z),
|
||||||
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
]
|
||||||
]
|
axis2 = [
|
||||||
axis_color1 = decorator_color_y_axis
|
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
||||||
axis_color2 = decorator_color_z_axis
|
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
||||||
else:
|
]
|
||||||
return
|
axis_color1 = decorator_color_y_axis
|
||||||
# When a point is above the plane it projects the point
|
axis_color2 = decorator_color_z_axis
|
||||||
# to the plane and creates a line
|
else:
|
||||||
if snap_prop.snap_type != "Plane":
|
return
|
||||||
if self.tool_state.use_default_container and snap_prop.z != 0:
|
# When a point is above the plane it projects the point
|
||||||
projection_point = [Vector((snap_prop.x, snap_prop.y, default_container_elevation))]
|
# to the plane and creates a line
|
||||||
self.line_shader.uniform_float("lineWidth", 1.0)
|
if snap_prop.snap_type != "Plane":
|
||||||
self.draw_batch("POINTS", projection_point, decorator_color_unselected)
|
if self.tool_state.use_default_container and snap_prop.z != 0:
|
||||||
edges = [[0, 1]]
|
projection_point = [Vector((snap_prop.x, snap_prop.y, default_container_elevation))]
|
||||||
self.draw_batch("LINES", mouse_point + projection_point, decorator_color_unselected, edges)
|
self.line_shader.uniform_float("lineWidth", 1.0)
|
||||||
|
self.draw_batch("POINTS", projection_point, decorator_color_unselected)
|
||||||
|
edges = [[0, 1]]
|
||||||
|
self.draw_batch("LINES", mouse_point + projection_point, decorator_color_unselected, edges)
|
||||||
|
|
||||||
if axis1 and axis2:
|
if axis1 and axis2:
|
||||||
self.line_shader.uniform_float("lineWidth", 1.5)
|
self.line_shader.uniform_float("lineWidth", 1.5)
|
||||||
self.draw_batch("LINES", axis1, highlight_color(axis_color1), [(0, 1)])
|
self.draw_batch("LINES", axis1, highlight_color(axis_color1), [(0, 1)])
|
||||||
self.draw_batch("LINES", axis2, highlight_color(axis_color2), [(0, 1)])
|
self.draw_batch("LINES", axis2, highlight_color(axis_color2), [(0, 1)])
|
||||||
|
|
||||||
# Create polyline with selected points
|
# Create polyline with selected points
|
||||||
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline
|
polyline_data = context.scene.BIMPolylineProperties.insertion_polyline
|
||||||
|
|||||||
Reference in New Issue
Block a user