]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Rotating eccentric reducer did not update elbows on the same leg 25/3025/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 17 Jul 2019 09:03:26 +0000 (12:03 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 17 Jul 2019 09:03:26 +0000 (12:03 +0300)
gitlab #12

Change-Id: I81392a1c6d2644f6b7d7c5c336a9e870582380be

org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java

index 5f52c52521ac8ad4b56b78be49741547225ea920..26e2bb52de68974d253cd4befea10e7e26fd9bd6 100644 (file)
@@ -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;