]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java
Preliminary example of creating pipes with elbow coordinates
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / utils / ComponentUtils.java
index cc19260b41bf719ddda3df07a7460f3c4b62f8ee..15ee7918ca1709501eab1bc076054a1459df479f 100644 (file)
@@ -516,7 +516,7 @@ public class ComponentUtils {
                 requiresReverse = true;
             }
             PipeRun other = endCP.getPipeRun();
-            boolean mergeRuns = pipeRun.equalSpecs(other);
+            boolean mergeRuns = other == null ? true : pipeRun.equalSpecs(other);
             
             if (requiresReverse) {
                 // Pipe line must be traversible with next/previous relations without direction change.
@@ -526,8 +526,15 @@ public class ComponentUtils {
             }
             if (mergeRuns) {
                 // Runs have compatible specs and must be merged
-                if (pipeRun != other) // FIXME: temporary workaround.
+                if (other != null && pipeRun != other)
                     PipingRules.merge(pipeRun, other);
+                else if (other == null) {
+                    if (!(endTo instanceof Nozzle)) {
+                        pipeRun.addChild(endTo);
+                    } else {
+                        endTo.setPipeRun(pipeRun);
+                    }
+                }
                 if (!reversed) {
                     currentCP.setNext(endCP);
                     endCP.setPrevious(currentCP);