mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Small refactor. Variable renaming.
This commit is contained in:
@@ -355,7 +355,7 @@ class PolylineDecorator:
|
|||||||
cls.tool_state = tool_state
|
cls.tool_state = tool_state
|
||||||
|
|
||||||
def calculate_measurement_x_y_and_z(self, context):
|
def calculate_measurement_x_y_and_z(self, context):
|
||||||
measurement_prop = context.scene.BIMPolylineProperties.polyline_point
|
measurement_prop = context.scene.BIMPolylineProperties.polyline_points
|
||||||
|
|
||||||
if len(measurement_prop) == 0 or len(measurement_prop) > 2:
|
if len(measurement_prop) == 0 or len(measurement_prop) > 2:
|
||||||
return None, None
|
return None, None
|
||||||
@@ -413,7 +413,7 @@ class PolylineDecorator:
|
|||||||
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
||||||
self.line_shader.uniform_float("lineWidth", 2.0)
|
self.line_shader.uniform_float("lineWidth", 2.0)
|
||||||
decorator_color = self.addon_prefs.decorator_color_special
|
decorator_color = self.addon_prefs.decorator_color_special
|
||||||
polyline = context.scene.BIMPolylineProperties.polyline_point
|
polyline = context.scene.BIMPolylineProperties.polyline_points
|
||||||
prop = context.scene.BIMPolylineProperties.product_preview
|
prop = context.scene.BIMPolylineProperties.product_preview
|
||||||
|
|
||||||
points = []
|
points = []
|
||||||
@@ -527,7 +527,7 @@ class PolylineDecorator:
|
|||||||
region = context.region
|
region = context.region
|
||||||
rv3d = region.data
|
rv3d = region.data
|
||||||
measure_type = context.scene.MeasureToolSettings.measure_type
|
measure_type = context.scene.MeasureToolSettings.measure_type
|
||||||
measurement_prop = context.scene.BIMPolylineProperties.polyline_point
|
measurement_prop = context.scene.BIMPolylineProperties.polyline_points
|
||||||
|
|
||||||
self.addon_prefs = tool.Blender.get_addon_preferences()
|
self.addon_prefs = tool.Blender.get_addon_preferences()
|
||||||
self.font_id = 1
|
self.font_id = 1
|
||||||
@@ -673,7 +673,7 @@ class PolylineDecorator:
|
|||||||
self.draw_batch("LINES", mouse_point + projection_point, decorator_color_unselected, edges)
|
self.draw_batch("LINES", mouse_point + projection_point, decorator_color_unselected, edges)
|
||||||
|
|
||||||
# Create polyline with selected points
|
# Create polyline with selected points
|
||||||
polyline_data = context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = context.scene.BIMPolylineProperties.polyline_points
|
||||||
polyline_points = []
|
polyline_points = []
|
||||||
polyline_edges = []
|
polyline_edges = []
|
||||||
for point_prop in polyline_data:
|
for point_prop in polyline_data:
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class AddOccurrence(bpy.types.Operator, PolylineOperator):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
point = context.scene.BIMPolylineProperties.polyline_point[0]
|
point = context.scene.BIMPolylineProperties.polyline_points[0]
|
||||||
context.scene.cursor.location = Vector((point.x, point.y, point.z))
|
context.scene.cursor.location = Vector((point.x, point.y, point.z))
|
||||||
tool.Snap.clear_polyline()
|
tool.Snap.clear_polyline()
|
||||||
|
|
||||||
|
|||||||
@@ -757,6 +757,6 @@ class MeasurePolyline(PropertyGroup):
|
|||||||
class BIMPolylineProperties(PropertyGroup):
|
class BIMPolylineProperties(PropertyGroup):
|
||||||
snap_mouse_point: bpy.props.CollectionProperty(type=SnapMousePoint)
|
snap_mouse_point: bpy.props.CollectionProperty(type=SnapMousePoint)
|
||||||
snap_mouse_ref: bpy.props.CollectionProperty(type=SnapMousePoint)
|
snap_mouse_ref: bpy.props.CollectionProperty(type=SnapMousePoint)
|
||||||
polyline_point: bpy.props.CollectionProperty(type=PolylinePoint)
|
polyline_points: bpy.props.CollectionProperty(type=PolylinePoint)
|
||||||
product_preview: bpy.props.CollectionProperty(type=PolylinePoint)
|
product_preview: bpy.props.CollectionProperty(type=PolylinePoint)
|
||||||
measure_polyline: bpy.props.CollectionProperty(type=MeasurePolyline)
|
measure_polyline: bpy.props.CollectionProperty(type=MeasurePolyline)
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ class DumbWallGenerator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def derive_from_polyline(self):
|
def derive_from_polyline(self):
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
is_polyline_closed = False
|
is_polyline_closed = False
|
||||||
if len(polyline_data) > 3:
|
if len(polyline_data) > 3:
|
||||||
first_vec = Vector((polyline_data[0].x, polyline_data[0].y, polyline_data[0].z))
|
first_vec = Vector((polyline_data[0].x, polyline_data[0].y, polyline_data[0].z))
|
||||||
|
|||||||
@@ -2411,7 +2411,7 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
|
|||||||
self.handle_snap_selection(context, event)
|
self.handle_snap_selection(context, event)
|
||||||
|
|
||||||
single_mode = False
|
single_mode = False
|
||||||
if self.measure_type == "SINGLE" and len(context.scene.BIMPolylineProperties.polyline_point) >= 2:
|
if self.measure_type == "SINGLE" and len(context.scene.BIMPolylineProperties.polyline_points) >= 2:
|
||||||
single_mode = True
|
single_mode = True
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
def calculate_distance_and_angle(cls, context, input_ui, tool_state):
|
def calculate_distance_and_angle(cls, context, input_ui, tool_state):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
polyline_data = context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = context.scene.BIMPolylineProperties.polyline_points
|
||||||
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
|
||||||
last_point_data = polyline_data[len(polyline_data) - 1]
|
last_point_data = polyline_data[len(polyline_data) - 1]
|
||||||
except:
|
except:
|
||||||
@@ -186,7 +186,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def calculate_area(cls, context, input_ui):
|
def calculate_area(cls, context, input_ui):
|
||||||
try:
|
try:
|
||||||
polyline_data = context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = context.scene.BIMPolylineProperties.polyline_points
|
||||||
except:
|
except:
|
||||||
return input_ui
|
return input_ui
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def calculate_x_y_and_z(cls, context, input_ui, tool_state):
|
def calculate_x_y_and_z(cls, context, input_ui, tool_state):
|
||||||
try:
|
try:
|
||||||
polyline_data = context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = context.scene.BIMPolylineProperties.polyline_points
|
||||||
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
|
||||||
last_point_data = polyline_data[len(polyline_data) - 1]
|
last_point_data = polyline_data[len(polyline_data) - 1]
|
||||||
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
||||||
@@ -313,7 +313,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
|
|
||||||
base_vertices = []
|
base_vertices = []
|
||||||
top_vertices = []
|
top_vertices = []
|
||||||
polyline_data = context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = context.scene.BIMPolylineProperties.polyline_points
|
||||||
if len(polyline_data) < 2:
|
if len(polyline_data) < 2:
|
||||||
context.scene.BIMPolylineProperties.product_preview.clear()
|
context.scene.BIMPolylineProperties.product_preview.clear()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
except:
|
except:
|
||||||
loc = Vector((0, 0, 0))
|
loc = Vector((0, 0, 0))
|
||||||
|
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
polyline_data = polyline_data[
|
polyline_data = polyline_data[
|
||||||
: len(polyline_data) - 1
|
: len(polyline_data) - 1
|
||||||
] # It doesn't make sense to snap to the last point created
|
] # It doesn't make sense to snap to the last point created
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
y = snap_vertex.y
|
y = snap_vertex.y
|
||||||
z = snap_vertex.z
|
z = snap_vertex.z
|
||||||
|
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
if polyline_data:
|
if polyline_data:
|
||||||
# Avoids creating two points at the same location
|
# Avoids creating two points at the same location
|
||||||
for point in polyline_data[1:]: # The first can be repeated to form a wall loop
|
for point in polyline_data[1:]: # The first can be repeated to form a wall loop
|
||||||
@@ -126,7 +126,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
if round(length, 4) < 0.1:
|
if round(length, 4) < 0.1:
|
||||||
return "Cannot create a segment smaller then 10cm"
|
return "Cannot create a segment smaller then 10cm"
|
||||||
|
|
||||||
polyline_point = bpy.context.scene.BIMPolylineProperties.polyline_point.add()
|
polyline_point = bpy.context.scene.BIMPolylineProperties.polyline_points.add()
|
||||||
polyline_point.x = x
|
polyline_point.x = x
|
||||||
polyline_point.y = y
|
polyline_point.y = y
|
||||||
polyline_point.z = z
|
polyline_point.z = z
|
||||||
@@ -137,28 +137,28 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def close_polyline(cls):
|
def close_polyline(cls):
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
if len(polyline_data) > 2:
|
if len(polyline_data) > 2:
|
||||||
first_point = polyline_data[0]
|
first_point = polyline_data[0]
|
||||||
last_point = polyline_data[-1]
|
last_point = polyline_data[-1]
|
||||||
if not (first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z):
|
if not (first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z):
|
||||||
polyline_point = bpy.context.scene.BIMPolylineProperties.polyline_point.add()
|
polyline_point = bpy.context.scene.BIMPolylineProperties.polyline_points.add()
|
||||||
polyline_point.x = first_point.x
|
polyline_point.x = first_point.x
|
||||||
polyline_point.y = first_point.y
|
polyline_point.y = first_point.y
|
||||||
polyline_point.z = first_point.z
|
polyline_point.z = first_point.z
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_polyline(cls):
|
def clear_polyline(cls):
|
||||||
bpy.context.scene.BIMPolylineProperties.polyline_point.clear()
|
bpy.context.scene.BIMPolylineProperties.polyline_points.clear()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def remove_last_polyline_point(cls):
|
def remove_last_polyline_point(cls):
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
polyline_data.remove(len(polyline_data) - 1)
|
polyline_data.remove(len(polyline_data) - 1)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def move_polyline_to_measure(cls):
|
def move_polyline_to_measure(cls):
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
measure_data = bpy.context.scene.BIMPolylineProperties.measure_polyline.add()
|
measure_data = bpy.context.scene.BIMPolylineProperties.measure_polyline.add()
|
||||||
for point in polyline_data:
|
for point in polyline_data:
|
||||||
measure_point = measure_data.polyline_point.add()
|
measure_point = measure_data.polyline_point.add()
|
||||||
@@ -203,7 +203,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
return (v1, v2, v3, v4)
|
return (v1, v2, v3, v4)
|
||||||
|
|
||||||
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
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
if polyline_data:
|
if polyline_data:
|
||||||
last_point_data = polyline_data[-1]
|
last_point_data = polyline_data[-1]
|
||||||
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
||||||
@@ -382,7 +382,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
detected_snaps.append({"Edge-Vertex": (obj, snap_point)})
|
detected_snaps.append({"Edge-Vertex": (obj, snap_point)})
|
||||||
# Polyline
|
# Polyline
|
||||||
try:
|
try:
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_points
|
||||||
last_polyline_point = polyline_data[len(polyline_data) - 1]
|
last_polyline_point = polyline_data[len(polyline_data) - 1]
|
||||||
except:
|
except:
|
||||||
last_polyline_point = None
|
last_polyline_point = None
|
||||||
|
|||||||
Reference in New Issue
Block a user