Skip to content

Commit d7c1b17

Browse files
committed
Align two port connectors
1 parent 7139920 commit d7c1b17

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modelica_fmi/src/modelica_fmi/import_fmu_to_modelica.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,23 @@ def import_fmu_to_modelica(
159159

160160
if not hide_connectors:
161161
for i, variable in enumerate(inputs):
162-
y = 0 if len(inputs) == 1 else y1 - i * (height / (len(inputs) - 1))
162+
if len(inputs) == 1:
163+
y = 0
164+
elif len(inputs) == 2:
165+
y = -50 if i == 0 else 50
166+
else:
167+
y = 0 if len(inputs) == 1 else y1 - i * (height / (len(inputs) - 1))
163168
annotations[variable.name] = (
164169
f" annotation(Placement(transformation(extent={{ {{ {x0 - 40}, {y - 20} }}, {{ {x0}, {y + 20} }} }}), iconTransformation(extent={{ {{ {x0 - 40}, {y - 20} }}, {{ {x0}, {y + 20} }} }})))"
165170
)
166171

167172
for i, variable in enumerate(outputs):
168-
y = 0 if len(outputs) == 1 else y1 - i * (height / (len(outputs) - 1))
173+
if len(outputs) == 1:
174+
y = 0
175+
elif len(outputs) == 2:
176+
y = -50 if i == 0 else 50
177+
else:
178+
y = 0 if len(outputs) == 1 else y1 - i * (height / (len(outputs) - 1))
169179
annotations[variable.name] = (
170180
f" annotation(Placement(transformation(extent={{ {{ {x1}, {y - 10} }}, {{ {x1 + 20}, {y + 10} }} }}), iconTransformation(extent={{ {{ {x1}, {y - 10} }}, {{ {x1 + 20}, {y + 10} }} }})))"
171181
)

0 commit comments

Comments
 (0)