mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
connect the ports when creating several conected IfcFlowSegment with polyline
This commit is contained in:
@@ -1131,8 +1131,14 @@ class DrawPolylineProfile(bpy.types.Operator, PolylineOperator, tool.Ifc.Operato
|
|||||||
|
|
||||||
MEPGenerator().setup_ports(profile1["obj"])
|
MEPGenerator().setup_ports(profile1["obj"])
|
||||||
else:
|
else:
|
||||||
|
connect_IfcFlowSegments = tool.Ifc.get_entity(profiles[0]["obj"]).is_a("IfcFlowSegment")
|
||||||
for profile1, profile2 in zip(profiles[:-1], profiles[1:]):
|
for profile1, profile2 in zip(profiles[:-1], profiles[1:]):
|
||||||
DumbProfileJoiner().join_V(profile2["obj"], profile1["obj"])
|
DumbProfileJoiner().join_V(profile2["obj"], profile1["obj"])
|
||||||
|
if connect_IfcFlowSegments:
|
||||||
|
bpy.ops.bim.mep_connect_elements(
|
||||||
|
obj1_name=profile1["obj"].name,
|
||||||
|
obj2_name=profile2["obj"].name
|
||||||
|
)
|
||||||
|
|
||||||
def modal(self, context, event):
|
def modal(self, context, event):
|
||||||
return IfcStore.execute_ifc_operator(self, context, event, method="MODAL")
|
return IfcStore.execute_ifc_operator(self, context, event, method="MODAL")
|
||||||
|
|||||||
@@ -317,17 +317,19 @@ class MEPConnectElements(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Connect MEP Elements"
|
bl_label = "Connect MEP Elements"
|
||||||
bl_description = "Connects two selected elements by their closest located ports and adjusts them"
|
bl_description = "Connects two selected elements by their closest located ports and adjusts them"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
obj1_name: bpy.props.StringProperty(name="Object 1")
|
||||||
@classmethod
|
obj2_name: bpy.props.StringProperty(name="Object 2")
|
||||||
def poll(cls, context):
|
|
||||||
if not len(context.selected_objects) == 2:
|
|
||||||
cls.poll_message_set("Need to select 2 objects.")
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
obj1 = context.active_object
|
if self.obj1_name and self.obj2_name:
|
||||||
obj2 = next(o for o in context.selected_objects if o != obj1)
|
obj1 = bpy.data.objects.get(self.obj1_name)
|
||||||
|
obj2 = bpy.data.objects.get(self.obj2_name)
|
||||||
|
else:
|
||||||
|
if not context.selected_objects or len(context.selected_objects) != 2:
|
||||||
|
self.report({"ERROR"}, "Need to select 2 objects.")
|
||||||
|
return {"CANCELLED"}
|
||||||
|
obj1 = context.active_object
|
||||||
|
obj2 = next(o for o in context.selected_objects if o != obj1)
|
||||||
|
|
||||||
tool.Model.sync_object_ifc_position(obj1)
|
tool.Model.sync_object_ifc_position(obj1)
|
||||||
tool.Model.sync_object_ifc_position(obj2)
|
tool.Model.sync_object_ifc_position(obj2)
|
||||||
|
|||||||
Reference in New Issue
Block a user