- if (newComponent instanceof InlineComponent) {
- InlineComponent inlineComponent = (InlineComponent)newComponent;
- if (inlineComponent.isVariableLength()|| inlineComponent.isModifialble()) {
- newPcp.setLength(inst.length);
- newComponent.setParameter("length", inst.length);
- }
- if (inst.rotationAngle != null)
- ((InlineComponent) newComponent).setRotationAngle(inst.rotationAngle);
- } else if (newComponent instanceof TurnComponent) {
- TurnComponent turnComponent = (TurnComponent)newComponent;
- if (turnComponent.isVariableAngle()) {
- newPcp.setTurnAngle(inst.angle);
- newComponent.setParameter("turnAngle", inst.angle);
- }
- if (inst.rotationAngle != null)
- ((TurnComponent) newComponent).setRotationAngle(inst.rotationAngle);
- }
-
-
- newComponent.updateParameters();
+ if (newComponent instanceof InlineComponent) {
+ InlineComponent inlineComponent = (InlineComponent)newComponent;
+ if (inlineComponent.isVariableLength()|| inlineComponent.isModifialble()) {
+ newPcp.setLength(inst.length);
+ newComponent.setParameter("length", inst.length);
+ }
+ if (inst.rotationAngle != null)
+ ((InlineComponent) newComponent).setRotationAngle(inst.rotationAngle);
+ } else if (newComponent instanceof TurnComponent) {
+ TurnComponent turnComponent = (TurnComponent)newComponent;
+ if (turnComponent.isVariableAngle()) {
+ newPcp.setTurnAngle(Math.toRadians(inst.angle));
+ newComponent.setParameter("turnAngle", inst.angle);
+ }
+ if (inst.rotationAngle != null)
+ ((TurnComponent) newComponent).setRotationAngle(inst.rotationAngle);
+ }
+
+ newComponent.updateParameters();
+
+ 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;