mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 16:06:27 +00:00
black format
This commit is contained in:
@@ -29,8 +29,9 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_idname = "bim.add_opening"
|
bl_idname = "bim.add_opening"
|
||||||
bl_label = "Add Opening"
|
bl_label = "Add Opening"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Adds an opening to an element.\n" \
|
bl_description = (
|
||||||
"Need to select two elements, order of selection is not important"
|
"Adds an opening to an element.\n" "Need to select two elements, order of selection is not important"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -41,12 +42,10 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.BIMModelProperties
|
props = context.scene.BIMModelProperties
|
||||||
selected_objects = context.selected_objects
|
selected_objects = context.selected_objects
|
||||||
target_object = selected_objects[0]
|
target_object = selected_objects[0]
|
||||||
|
|
||||||
|
|
||||||
opening_objects = [obj for obj in selected_objects if obj != target_object]
|
opening_objects = [obj for obj in selected_objects if obj != target_object]
|
||||||
|
|
||||||
|
|
||||||
for opening_obj in opening_objects:
|
for opening_obj in opening_objects:
|
||||||
element1 = tool.Ifc.get_entity(target_object)
|
element1 = tool.Ifc.get_entity(target_object)
|
||||||
obj1 = target_object
|
obj1 = target_object
|
||||||
@@ -58,7 +57,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
if element1 and element2:
|
if element1 and element2:
|
||||||
if element1.is_a("IfcOpeningElement") and element2.is_a("IfcOpeningElement"):
|
if element1.is_a("IfcOpeningElement") and element2.is_a("IfcOpeningElement"):
|
||||||
self.report({'INFO'}, "You can't add an opening to another opening.")
|
self.report({"INFO"}, "You can't add an opening to another opening.")
|
||||||
continue
|
continue
|
||||||
elif not element1.is_a("IfcOpeningElement") and not element2.is_a("IfcOpeningElement"):
|
elif not element1.is_a("IfcOpeningElement") and not element2.is_a("IfcOpeningElement"):
|
||||||
if element1.is_a("IfcWindow") or element1.is_a("IfcDoor"): # Add a fill to an element.
|
if element1.is_a("IfcWindow") or element1.is_a("IfcDoor"): # Add a fill to an element.
|
||||||
@@ -75,7 +74,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element1, element2 = element2, element1
|
element1, element2 = element2, element1
|
||||||
|
|
||||||
if element1.is_a("IfcOpeningElement"):
|
if element1.is_a("IfcOpeningElement"):
|
||||||
self.report({'INFO'}, "You can't add an opening to another opening.")
|
self.report({"INFO"}, "You can't add an opening to another opening.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if tool.Ifc.is_moved(obj1):
|
if tool.Ifc.is_moved(obj1):
|
||||||
|
|||||||
@@ -979,8 +979,8 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
if nosing_length < 0: # tread gaps
|
if nosing_length < 0: # tread gaps
|
||||||
length += abs(nosing_length) * number_of_treads
|
length += abs(nosing_length) * number_of_treads
|
||||||
calculated_params["Length"] = round(length, 5)
|
calculated_params["Length"] = round(length, 5)
|
||||||
pitch = height/length
|
pitch = height / length
|
||||||
pitch_formatted = str(round(pitch*100, 1)) + ' % / ' + str(round(degrees(atan(pitch)), 1)) + ' deg'
|
pitch_formatted = str(round(pitch * 100, 1)) + " % / " + str(round(degrees(atan(pitch)), 1)) + " deg"
|
||||||
calculated_params["Pitch"] = str(pitch_formatted)
|
calculated_params["Pitch"] = str(pitch_formatted)
|
||||||
|
|
||||||
return calculated_params
|
return calculated_params
|
||||||
|
|||||||
Reference in New Issue
Block a user