mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
black .
This commit is contained in:
@@ -228,7 +228,7 @@ class AuthoringData:
|
|||||||
results.extend([(c, c, "") for c in sorted(classes)])
|
results.extend([(c, c, "") for c in sorted(classes)])
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ifc_class_current(cls):
|
def ifc_class_current(cls):
|
||||||
ifc_classes = cls.data["ifc_classes"]
|
ifc_classes = cls.data["ifc_classes"]
|
||||||
if not ifc_classes:
|
if not ifc_classes:
|
||||||
@@ -248,7 +248,7 @@ class AuthoringData:
|
|||||||
return [(str(e.id()), e.Name or "Unnamed", e.Description or "") for e in results]
|
return [(str(e.id()), e.Name or "Unnamed", e.Description or "") for e in results]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def relating_type_id_current(cls):
|
def relating_type_id_current(cls):
|
||||||
relating_type_id = tool.Blender.get_enum_safe(cls.props, "relating_type_id")
|
relating_type_id = tool.Blender.get_enum_safe(cls.props, "relating_type_id")
|
||||||
relating_type_id_data = cls.data["relating_type_id"]
|
relating_type_id_data = cls.data["relating_type_id"]
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ def transparent_color(color, alpha=0.1):
|
|||||||
color[3] = alpha
|
color[3] = alpha
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
||||||
def highlight_color(color, alpha=0.1):
|
def highlight_color(color, alpha=0.1):
|
||||||
color = [i + (1 - i) * 0.5 for i in color]
|
color = [i + (1 - i) * 0.5 for i in color]
|
||||||
return color
|
return color
|
||||||
@@ -641,20 +642,38 @@ class PolylineDecorator:
|
|||||||
axis2 = None
|
axis2 = None
|
||||||
if self.tool_state.plane_method == "XY":
|
if self.tool_state.plane_method == "XY":
|
||||||
projection_point = [Vector((snap_prop.x, snap_prop.y, self.tool_state.plane_origin.z))]
|
projection_point = [Vector((snap_prop.x, snap_prop.y, self.tool_state.plane_origin.z))]
|
||||||
axis1 = [(plane_origin.x - 10000, plane_origin.y, plane_origin.z), (plane_origin.x + 10000, plane_origin.y, plane_origin.z)]
|
axis1 = [
|
||||||
axis2 = [(plane_origin.x, plane_origin.y - 10000, plane_origin.z), (plane_origin.x, plane_origin.y + 100000, plane_origin.z)]
|
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
||||||
|
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
||||||
|
]
|
||||||
|
axis2 = [
|
||||||
|
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
||||||
|
(plane_origin.x, plane_origin.y + 100000, plane_origin.z),
|
||||||
|
]
|
||||||
axis_color1 = decorator_color_x_axis
|
axis_color1 = decorator_color_x_axis
|
||||||
axis_color2 = decorator_color_y_axis
|
axis_color2 = decorator_color_y_axis
|
||||||
elif self.tool_state.plane_method == "XZ":
|
elif self.tool_state.plane_method == "XZ":
|
||||||
projection_point = [Vector((snap_prop.x, self.tool_state.plane_origin.y, snap_prop.z))]
|
projection_point = [Vector((snap_prop.x, self.tool_state.plane_origin.y, snap_prop.z))]
|
||||||
axis1 = [(plane_origin.x - 10000, plane_origin.y, plane_origin.z), (plane_origin.x + 10000, plane_origin.y, plane_origin.z)]
|
axis1 = [
|
||||||
axis2 = [(plane_origin.x, plane_origin.y, plane_origin.z - 10000), (plane_origin.x, plane_origin.y, plane_origin.z + 100000)]
|
(plane_origin.x - 10000, plane_origin.y, plane_origin.z),
|
||||||
|
(plane_origin.x + 10000, plane_origin.y, plane_origin.z),
|
||||||
|
]
|
||||||
|
axis2 = [
|
||||||
|
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
||||||
|
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
||||||
|
]
|
||||||
axis_color1 = decorator_color_x_axis
|
axis_color1 = decorator_color_x_axis
|
||||||
axis_color2 = decorator_color_z_axis
|
axis_color2 = decorator_color_z_axis
|
||||||
elif self.tool_state.plane_method == "YZ":
|
elif self.tool_state.plane_method == "YZ":
|
||||||
projection_point = [Vector((self.tool_state.plane_origin.x, snap_prop.y, snap_prop.z))]
|
projection_point = [Vector((self.tool_state.plane_origin.x, snap_prop.y, snap_prop.z))]
|
||||||
axis1 = [(plane_origin.x, plane_origin.y - 10000, plane_origin.z), (plane_origin.x, plane_origin.y + 10000, plane_origin.z)]
|
axis1 = [
|
||||||
axis2 = [(plane_origin.x, plane_origin.y, plane_origin.z - 10000), (plane_origin.x, plane_origin.y, plane_origin.z + 100000)]
|
(plane_origin.x, plane_origin.y - 10000, plane_origin.z),
|
||||||
|
(plane_origin.x, plane_origin.y + 10000, plane_origin.z),
|
||||||
|
]
|
||||||
|
axis2 = [
|
||||||
|
(plane_origin.x, plane_origin.y, plane_origin.z - 10000),
|
||||||
|
(plane_origin.x, plane_origin.y, plane_origin.z + 100000),
|
||||||
|
]
|
||||||
axis_color1 = decorator_color_y_axis
|
axis_color1 = decorator_color_y_axis
|
||||||
axis_color2 = decorator_color_z_axis
|
axis_color2 = decorator_color_z_axis
|
||||||
else:
|
else:
|
||||||
@@ -668,12 +687,11 @@ class PolylineDecorator:
|
|||||||
self.draw_batch("POINTS", projection_point, decorator_color_unselected)
|
self.draw_batch("POINTS", projection_point, decorator_color_unselected)
|
||||||
edges = [[0, 1]]
|
edges = [[0, 1]]
|
||||||
self.draw_batch("LINES", mouse_point + projection_point, decorator_color_unselected, edges)
|
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
|
||||||
|
|||||||
@@ -823,6 +823,7 @@ class DrawPolylineSlab(bpy.types.Operator, PolylineOperator):
|
|||||||
self.tool_state.plane_method = "XY"
|
self.tool_state.plane_method = "XY"
|
||||||
return {"RUNNING_MODAL"}
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
|
|
||||||
class RecalculateSlab(bpy.types.Operator, tool.Ifc.Operator):
|
class RecalculateSlab(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.recalculate_slab"
|
bl_idname = "bim.recalculate_slab"
|
||||||
bl_label = "Recalculate Slab"
|
bl_label = "Recalculate Slab"
|
||||||
@@ -840,6 +841,6 @@ class RecalculateSlab(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
for rel in element.ConnectedTo:
|
for rel in element.ConnectedTo:
|
||||||
if rel.is_a() == "IfcRelConnectsElements" and rel.RelatedElement.is_a("IfcWall"):
|
if rel.is_a() == "IfcRelConnectsElements" and rel.RelatedElement.is_a("IfcWall"):
|
||||||
walls.append(tool.Ifc.get_object(rel.RelatedElement))
|
walls.append(tool.Ifc.get_object(rel.RelatedElement))
|
||||||
|
|
||||||
DumbWallRecalculator().recalculate(walls)
|
DumbWallRecalculator().recalculate(walls)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator):
|
|||||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
self.handle_lock_axis(context, event) # Must come before "PASS_TRHOUGH"
|
self.handle_lock_axis(context, event) # Must come before "PASS_TRHOUGH"
|
||||||
|
|
||||||
if event.type in {"MIDDLEMOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE"}:
|
if event.type in {"MIDDLEMOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE"}:
|
||||||
self.handle_mouse_move(context, event)
|
self.handle_mouse_move(context, event)
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||||
|
|
||||||
plane_origin, plane_normal = select_plane_method()
|
plane_origin, plane_normal = select_plane_method()
|
||||||
tool_state.plane_origin = plane_origin # This will be used along with plane method
|
tool_state.plane_origin = plane_origin # This will be used along with plane method
|
||||||
|
|
||||||
intersection = tool.Raycast.ray_cast_to_plane(context, event, plane_origin, plane_normal)
|
intersection = tool.Raycast.ray_cast_to_plane(context, event, plane_origin, plane_normal)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user