X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Futils%2FComponentUtils.java;h=438e0bd6a96eae87cf8121640a11bfd350409161;hb=47a78f85f52d380243f8138a8104f79299c3c86c;hp=2cef7060c14ede3b748ddb821146d26d8bc6ecdb;hpb=d207cfa3235339e7d7b894494be400160b121bd5;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java index 2cef7060..438e0bd6 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java @@ -281,6 +281,7 @@ public class ComponentUtils { // Reducer requires pipe specs public Double diameter; + public Double thickness; public Double turnRadius; // Variable length @@ -331,6 +332,14 @@ public class ComponentUtils { public void setDiameter(Double diameter) { this.diameter = diameter; } + + public double getThickness() { + return thickness; + } + + public void setThickness(double thickness) { + this.thickness = thickness; + } public Double getTurnRadius() { return turnRadius; @@ -490,6 +499,11 @@ public class ComponentUtils { Vector3d v = new Vector3d(dir); if (insertAdjustable) { + // Prevent moving of adjacent components - always insert at end of a connected variable length component + if (position == PositionType.NEXT && component.getNext() != null || + position == PositionType.PREVIOUS && component.getPrevious() != null) + insertPosition = PositionType.PREVIOUS; + if (insertPosition == PositionType.NEXT) v.scale(newComponent.getControlPoint().getInlineLength()); else if (insertPosition == PositionType.SPLIT) @@ -516,14 +530,20 @@ public class ComponentUtils { case NEXT: if (toPcp.isDualInline()) toPcp = toPcp.getDualSub(); - newPcp.insert(toPcp, Direction.NEXT); newPcp.setWorldPosition(pos); + if (toPcp.getNext() != null) + PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, false); + else + newPcp.insert(toPcp, Direction.NEXT); break; case PREVIOUS: if (toPcp.isDualSub()) toPcp = toPcp.parent; - newPcp.insert(toPcp, Direction.PREVIOUS); newPcp.setWorldPosition(pos); + if (toPcp.getPrevious() != null) + PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, false); + else + newPcp.insert(toPcp, Direction.PREVIOUS); break; case SPLIT: PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, true); @@ -537,6 +557,7 @@ public class ComponentUtils { String n = root.getUniqueName("PipeRun"); other.setName(n); other.setPipeDiameter(inst.diameter); + other.setPipeThickness(inst.thickness); other.setTurnRadius(inst.turnRadius); root.addChild(other);