mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
black .
This commit is contained in:
@@ -252,7 +252,7 @@ class PolylineOperator:
|
|||||||
if event.value == "RELEASE" and event.type == "LEFTMOUSE":
|
if event.value == "RELEASE" and event.type == "LEFTMOUSE":
|
||||||
result = tool.Snap.insert_polyline_point(self.input_ui)
|
result = tool.Snap.insert_polyline_point(self.input_ui)
|
||||||
if result:
|
if result:
|
||||||
self.report({'WARNING'}, result)
|
self.report({"WARNING"}, result)
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
if event.value == "PRESS" and event.type == "C":
|
if event.value == "PRESS" and event.type == "C":
|
||||||
@@ -269,7 +269,7 @@ class PolylineOperator:
|
|||||||
if is_valid:
|
if is_valid:
|
||||||
result = tool.Snap.insert_polyline_point(self.input_ui)
|
result = tool.Snap.insert_polyline_point(self.input_ui)
|
||||||
if result:
|
if result:
|
||||||
self.report({'WARNING'}, result)
|
self.report({"WARNING"}, result)
|
||||||
|
|
||||||
self.tool_state.mode = "Mouse"
|
self.tool_state.mode = "Mouse"
|
||||||
self.tool_state.is_input_on = False
|
self.tool_state.is_input_on = False
|
||||||
|
|||||||
@@ -137,13 +137,15 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
||||||
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
|
||||||
if (x, y, z) == (point.x, point.y, point.z):
|
if (x, y, z) == (point.x, point.y, point.z):
|
||||||
return "Cannot create two points at the same location"
|
return "Cannot create two points at the same location"
|
||||||
print(type(snap_vertex))
|
print(type(snap_vertex))
|
||||||
print(type(polyline_data[-1]))
|
print(type(polyline_data[-1]))
|
||||||
# Avoids creating segments smaller then 0.1. This is a limitation from create_wall_from_2_points
|
# Avoids creating segments smaller then 0.1. This is a limitation from create_wall_from_2_points
|
||||||
length = (Vector((x, y, z)) - Vector((polyline_data[-1].x, polyline_data[-1].y, polyline_data[-1].z))).length
|
length = (
|
||||||
|
Vector((x, y, z)) - Vector((polyline_data[-1].x, polyline_data[-1].y, polyline_data[-1].z))
|
||||||
|
).length
|
||||||
if length < 0.1:
|
if length < 0.1:
|
||||||
return "Cannot create a segment smaller then 10cm"
|
return "Cannot create a segment smaller then 10cm"
|
||||||
|
|
||||||
|
|||||||
@@ -308,8 +308,7 @@ def get_product_quantity_names(elements: list[ifcopenshell.entity_instance]) ->
|
|||||||
|
|
||||||
|
|
||||||
def get_cost_schedule(cost_item: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
|
def get_cost_schedule(cost_item: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
|
||||||
"""Returns the cost schedule of a cost item.
|
"""Returns the cost schedule of a cost item."""
|
||||||
"""
|
|
||||||
for rel in cost_item.HasAssignments or []:
|
for rel in cost_item.HasAssignments or []:
|
||||||
if rel.is_a("IfcRelAssignsToControl") and rel.RelatingControl.is_a("IfcCostSchedule"):
|
if rel.is_a("IfcRelAssignsToControl") and rel.RelatingControl.is_a("IfcCostSchedule"):
|
||||||
return rel.RelatingControl
|
return rel.RelatingControl
|
||||||
@@ -320,12 +319,10 @@ def get_cost_schedule(cost_item: ifcopenshell.entity_instance) -> ifcopenshell.e
|
|||||||
def get_cost_rate(
|
def get_cost_rate(
|
||||||
file: ifcopenshell_wrapper.file, cost_item: ifcopenshell.entity_instance
|
file: ifcopenshell_wrapper.file, cost_item: ifcopenshell.entity_instance
|
||||||
) -> Optional[ifcopenshell.entity_instance]:
|
) -> Optional[ifcopenshell.entity_instance]:
|
||||||
"""Returns the cost rate of a cost item.
|
"""Returns the cost rate of a cost item."""
|
||||||
|
|
||||||
"""
|
|
||||||
# There is no direct relationship between a cost item and a cost rate in IFC, so we need to infer it, based on the assumption that cost_rate.CostValues == cost_item.CostValues.
|
# There is no direct relationship between a cost item and a cost rate in IFC, so we need to infer it, based on the assumption that cost_rate.CostValues == cost_item.CostValues.
|
||||||
if get_cost_schedule(cost_item).PredefinedType == "SCHEDULEOFRATES":
|
if get_cost_schedule(cost_item).PredefinedType == "SCHEDULEOFRATES":
|
||||||
return None # Cost item is already a cost rate
|
return None # Cost item is already a cost rate
|
||||||
if cost_item.CostValues:
|
if cost_item.CostValues:
|
||||||
potential_rates = file.get_inverse(cost_item.CostValues[0])
|
potential_rates = file.get_inverse(cost_item.CostValues[0])
|
||||||
for potential_rate in potential_rates:
|
for potential_rate in potential_rates:
|
||||||
|
|||||||
Reference in New Issue
Block a user