From: Marko Luukkainen Date: Tue, 12 Nov 2019 13:34:48 +0000 (+0200) Subject: Removing components left orphan piperuns in the plant X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=598ed1b91044329d7c1698b5ff2743be32a83582;p=simantics%2F3d.git Removing components left orphan piperuns in the plant gitlab #35 Change-Id: I428a58bf4e817816f2bb02d00186b41fa40a0527 (cherry picked from commit 31fd8b586a816e12d85f361b3fe2f6ebd52e427b) --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java index 491a2733..20386b54 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java @@ -1079,6 +1079,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { if (currentNext == null && currentPrev == null) { removeComponent(); pipeRun.remChild(this); + checkRemove(pipeRun); return; } if (currentNext != null && currentPrev != null) { @@ -1350,6 +1351,8 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { pcp._remove(); // This call will recursively call also this method... return true; } + } else if (points.size() == 2) { + } return false; } diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java index 3094f7d2..3ab4cca4 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java @@ -1671,7 +1671,11 @@ public class PipingRules { pcps.add(points); PipeControlPoint pcp = points.get(points.size()-1); if (pcp.getChildPoints().size() > 0) { - pipeRun = pcp.getChildPoints().get(0).getPipeRun(); + PipeRun pipeRun2 = pcp.getChildPoints().get(0).getPipeRun(); + if (pipeRun == pipeRun2) + break; + else + pipeRun = pipeRun2; } else { break; }