From 178e59c935e6c4eaa7897d9bf8c5113ee822878b Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Wed, 17 Jul 2019 12:03:26 +0300 Subject: [PATCH] Rotating eccentric reducer did not update elbows on the same leg gitlab #12 Change-Id: I81392a1c6d2644f6b7d7c5c336a9e870582380be --- .../scenegraph/controlpoint/PipingRules.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) 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 5f52c525..26e2bb52 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 @@ -92,10 +92,10 @@ public class PipingRules { validate(pcp.getPipeRun()); if (pcp.isPathLegEnd()) { updatePathLegEndControlPoint(pcp); // FXIME: Rules won't work properly, if they are not run twice. - updatePathLegEndControlPoint(pcp); + //updatePathLegEndControlPoint(pcp); } else { updateInlineControlPoint(pcp); - updateInlineControlPoint(pcp); + //updateInlineControlPoint(pcp); } validate(pcp.getPipeRun()); if (!allowInsertRemove) @@ -668,7 +668,7 @@ public class PipingRules { double l = beginPos.distance(endPos); if (Double.isNaN(l)) - System.out.println(); + System.out.println("Length for " + icp + " is NaN"); dir.scale(l * 0.5); beginPos.add(dir); // center position @@ -708,24 +708,24 @@ public class PipingRules { } private static void checkExpandPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange) throws Exception { - checkExpandPathLeg(u, lengthChange, false); + checkExpandPathLeg(u, lengthChange, u.updated.isInline() && u.updated.isOffset()); } - private static void checkExpandPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange, boolean forceUpdate) throws Exception { + private static void checkExpandPathLeg(UpdateStruct2 u, PathLegUpdateType lengthChange, boolean updateEnds) throws Exception { if (DEBUG) System.out.println("PipingRules.checkExpandPathLeg() " + u + " " + lengthChange); if (lengthChange != PathLegUpdateType.NONE) { // FIXME : turns cannot be checked before inline cps are updated, // since their position affects calculation of turns - processPathLeg(u, forceUpdate, false); + processPathLeg(u, updateEnds, false); int type = checkTurns(u, lengthChange); if (type == REMOVE_NONE) { - processPathLeg(u, forceUpdate, true); + processPathLeg(u, updateEnds, true); } else { expandPathLeg(u, type); } } else { - processPathLeg(u, forceUpdate, true); + processPathLeg(u, updateEnds, true); } } @@ -1601,6 +1601,11 @@ public class PipingRules { if (runPcps.size() != count) { System.out.println("Run is not connected"); } + for (PipeControlPoint pcp : pcps) { + if (!pcp.isDirected()) + if (pcp.getNext() == null && pcp.getPrevious() == null) + System.out.println("Orphan " + pcp); + } for (PipeControlPoint pcp : pcps) { if (pcp.getParentPoint() == null) { PipeControlPoint sub = null; -- 2.45.2