mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
black .
This commit is contained in:
@@ -35,13 +35,14 @@ class LoadGroups(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.expanded_groups = json.loads(context.scene.ExpandedGroups.json_string)
|
self.expanded_groups = json.loads(context.scene.ExpandedGroups.json_string)
|
||||||
self.props.groups.clear()
|
self.props.groups.clear()
|
||||||
|
|
||||||
groups = [group for group in tool.Ifc.get().by_type("IfcGroup", include_subtypes=False) if not group.HasAssignments]
|
groups = [
|
||||||
|
group for group in tool.Ifc.get().by_type("IfcGroup", include_subtypes=False) if not group.HasAssignments
|
||||||
|
]
|
||||||
sorted_groups = sorted(groups, key=lambda group: group.Name or "Unnamed")
|
sorted_groups = sorted(groups, key=lambda group: group.Name or "Unnamed")
|
||||||
|
|
||||||
for group in sorted_groups:
|
for group in sorted_groups:
|
||||||
self.load_group(group)
|
self.load_group(group)
|
||||||
|
|
||||||
|
|
||||||
self.props.is_editing = True
|
self.props.is_editing = True
|
||||||
bpy.ops.bim.disable_editing_group()
|
bpy.ops.bim.disable_editing_group()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -54,7 +55,12 @@ class LoadGroups(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
new.has_children = False
|
new.has_children = False
|
||||||
new.is_expanded = group.id() in self.expanded_groups
|
new.is_expanded = group.id() in self.expanded_groups
|
||||||
|
|
||||||
related_groups = [related_object for rel in group.IsGroupedBy or [] for related_object in rel.RelatedObjects if related_object.is_a("IfcGroup")]
|
related_groups = [
|
||||||
|
related_object
|
||||||
|
for rel in group.IsGroupedBy or []
|
||||||
|
for related_object in rel.RelatedObjects
|
||||||
|
if related_object.is_a("IfcGroup")
|
||||||
|
]
|
||||||
sorted_related_groups = sorted(related_groups, key=lambda group: group.Name or "Unnamed")
|
sorted_related_groups = sorted(related_groups, key=lambda group: group.Name or "Unnamed")
|
||||||
|
|
||||||
for related_group in sorted_related_groups:
|
for related_group in sorted_related_groups:
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
hit = None
|
hit = None
|
||||||
face_index = None
|
face_index = None
|
||||||
# Wireframes
|
# Wireframes
|
||||||
if obj.type in {"EMPTY", "CURVE"} or (hasattr(obj.data, "polygons") and len(obj.data.polygons) == 0) :
|
if obj.type in {"EMPTY", "CURVE"} or (hasattr(obj.data, "polygons") and len(obj.data.polygons) == 0):
|
||||||
snap_points = tool.Raycast.ray_cast_by_proximity(context, event, obj)
|
snap_points = tool.Raycast.ray_cast_by_proximity(context, event, obj)
|
||||||
if snap_points:
|
if snap_points:
|
||||||
hit = sorted(snap_points, key=lambda x: x["distance"])[0]["point"]
|
hit = sorted(snap_points, key=lambda x: x["distance"])[0]["point"]
|
||||||
@@ -569,7 +569,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
snap["distance"] *= weight_factor / 5
|
snap["distance"] *= weight_factor / 5
|
||||||
if snap["type"] == "Edge Intersection":
|
if snap["type"] == "Edge Intersection":
|
||||||
snap["distance"] *= weight_factor / 10
|
snap["distance"] *= weight_factor / 10
|
||||||
if snap["type"] in ["Plane", "Axis", "Face"]:
|
if snap["type"] in ["Plane", "Axis", "Face"]:
|
||||||
snap["distance"] = weight_factor / 50
|
snap["distance"] = weight_factor / 50
|
||||||
return sorted(snapping_points, key=lambda x: x["distance"])
|
return sorted(snapping_points, key=lambda x: x["distance"])
|
||||||
|
|
||||||
|
|||||||
@@ -344,13 +344,13 @@ class System(bonsai.core.tool.System):
|
|||||||
edge_ortho = obj.matrix_world.col[j].to_3d().normalized()
|
edge_ortho = obj.matrix_world.col[j].to_3d().normalized()
|
||||||
second_ortho = edge_dir.cross(edge_ortho)
|
second_ortho = edge_dir.cross(edge_ortho)
|
||||||
edge_ortho = second_ortho.cross(edge_dir)
|
edge_ortho = second_ortho.cross(edge_dir)
|
||||||
|
|
||||||
# direction lines should be around the edge center
|
# direction lines should be around the edge center
|
||||||
n_direction_lines, start_offset = divmod(edge_length, direction_lines_offset)
|
n_direction_lines, start_offset = divmod(edge_length, direction_lines_offset)
|
||||||
n_direction_lines = int(n_direction_lines) + 1
|
n_direction_lines = int(n_direction_lines) + 1
|
||||||
start_offset /= 2
|
start_offset /= 2
|
||||||
start_offset = edge_dir * start_offset + base_vert
|
start_offset = edge_dir * start_offset + base_vert
|
||||||
|
|
||||||
if both_directions:
|
if both_directions:
|
||||||
cur_vert_index = start_vert_i + len(port_data) + j * 2 * n_direction_lines
|
cur_vert_index = start_vert_i + len(port_data) + j * 2 * n_direction_lines
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user