Fixed bug adding ports to the transitions between profiles with an offset

end port ended up located without the offset
This commit is contained in:
Andrej730
2023-08-24 18:18:31 +05:00
parent a30ad9b886
commit 6226aea3c3
2 changed files with 7 additions and 4 deletions
@@ -801,7 +801,7 @@ class MEPAddTransition(bpy.types.Operator, tool.Ifc.Operator):
transition_obj.location = start_segment_extend_point if start_port_match else end_segment_extend_point
# add ports and connect them
ports = tool.System.add_ports(transition_obj)
ports = tool.System.add_ports(transition_obj, offset_end_port=profile_offset_ws)
if not start_port_match:
start_port, end_port = end_port, start_port
tool.Ifc.run("system.connect_port", port1=ports[0], port2=start_port, direction="NOTDEFINED")
+6 -3
View File
@@ -22,12 +22,12 @@ import blenderbim.core.tool
import blenderbim.tool as tool
from blenderbim.bim import import_ifc
import re
from mathutils import Matrix
from mathutils import Matrix, Vector
class System(blenderbim.core.tool.System):
@classmethod
def add_ports(cls, obj, add_start_port=True, add_end_port=True):
def add_ports(cls, obj, add_start_port=True, add_end_port=True, offset_end_port=None):
def add_port(mep_element, matrix):
port = tool.Ifc.run("system.add_port", element=mep_element)
port.FlowDirection = "NOTDEFINED"
@@ -47,7 +47,10 @@ class System(blenderbim.core.tool.System):
if add_start_port:
ports.append(add_port(mep_element, obj.matrix_world @ Matrix()))
if add_end_port:
ports.append(add_port(mep_element, obj.matrix_world @ Matrix.Translation((0, 0, length))))
m = obj.matrix_world @ Matrix.Translation((0, 0, length))
if offset_end_port:
m.translation += offset_end_port
ports.append(add_port(mep_element, m))
return ports
@classmethod