public override gpAx2 GetPointLocation(int index) { var ax2 = new gpAx2(); var axis = new gpAx1(); var point = new gpPnt(); var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); point = Dependency[0].Name == InterpreterNames.Reference ? Dependency[index].RefTransformedPoint3D.GpPnt : Dependency[index].TransformedPoint3D.GpPnt; axis.Location = (point); axis.Direction = axis.Direction.Transformed(transform); ax2.Axis = (axis); return(ax2); }
public override gpAx2 GetPointLocation(int index) { if (index < 0 || index > 2) { return(null); } var ax2 = new gpAx2(); var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); var arcLocation = Dependency[index].RefTransformedPoint3D.GpPnt; var pointBuilder = Dependency[0].ReferenceBuilder; var arcNormal = pointBuilder[0].Reference.Children[1].Get <Axis3DInterpreter>().Axis.Direction; ax2.Axis = new gpAx1(arcLocation, new gpDir(arcNormal.GpPnt.XYZ).Transformed(transform)); return(ax2); }
public override void UpdatePointPosition(int index, Mouse3DPosition vertex) { var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); var pointBuilder2 = Dependency[0].ReferenceBuilder; var arcNormal = pointBuilder2[0].Reference.Children[1].Get <Axis3DInterpreter>().Axis; var circleLocation = Dependency[0].RefTransformedPoint3D.GpPnt; var projection = GeomUtils.ProjectPointOnArc(new gpAx1(circleLocation, new gpDir(arcNormal.Direction.GpPnt.XYZ).Transformed(transform)), Dependency[1].RefTransformedPoint3D, vertex.Point, vertex.Point, true); if (projection != null) { Dependency[index].RefTransformedPoint3D = new Point3D(projection); } //ArcMetaAction.ArcAnimation(_gizmoDocument, Dependency[0].TransformedAxis3D, Dependency[1].TransformedPoint3D, Dependency[2].TransformedPoint3D); }
public override void UpdatePointPosition(int index, Mouse3DPosition vertex) { var sketchNode = Dependency[0].ReferenceBuilder[0].ReferenceBuilder[0].Node; var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); var sketchAx2 = new gpAx2 { Axis = (sketchNode.Get <Axis3DInterpreter>().Axis.GpAxis) }; sketchAx2.Direction = sketchAx2.Direction.Transformed(transform); var sketchPlane = new gpPln(new gpAx3(sketchAx2)); var projectedPoint = GeomUtils.ProjectPointOnPlane(vertex.Point.GpPnt, sketchPlane, Precision.Confusion); var originalFirstPoint = Dependency[0].RefTransformedPoint3D; var originalSecondPoint = Dependency[1].RefTransformedPoint3D; if (index == 0) { var secondPoint = Dependency[1].RefTransformedPoint3D; Dependency[0].RefTransformedPoint3D = new Point3D(projectedPoint); Dependency[1].RefTransformedPoint3D = secondPoint; } if (index == 1) { Dependency[1].RefTransformedPoint3D = new Point3D(projectedPoint); } var document = Dependency[0].Node.Root.Get <DocumentContextInterpreter>().Document; var constraintMapper = new ConstraintDocumentHelper(document, sketchNode); constraintMapper.SetMousePosition(Dependency[index].Reference.Index); var error = constraintMapper.ImpactAndSolve(Dependency[0].Node.Parent); if (error == 1) { Dependency[0].RefTransformedPoint3D = originalFirstPoint; Dependency[1].RefTransformedPoint3D = originalSecondPoint; } }
public override gpAx2 GetPointLocation(int index) { var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); var nodeAxis = Dependency[0].ReferenceBuilder[0].ReferenceBuilder[0].Node; var sketchAxis = nodeAxis.Get <Axis3DInterpreter>().Axis.GpAxis; sketchAxis.Direction = sketchAxis.Direction.Transformed(transform); var ax2 = new gpAx2(); if (index == 0) { sketchAxis.Location = (Dependency[0].RefTransformedPoint3D.GpPnt); ax2.Axis = (sketchAxis); return(ax2); } if (index == 1) { sketchAxis.Location = (Dependency[1].RefTransformedPoint3D.GpPnt); ax2.Axis = (sketchAxis); return(ax2); } return(null); }
public override gpAx2 GetPointLocation(int index) { //var transform = Node.Get<TransformationInterpreter>().CurrTransform; var transform = NodeBuilderUtils.GetGlobalTransformation(new NodeBuilder(NodeBuilderUtils.FindSketchNode(Node))); var ax2 = new gpAx2(); var centerAxis = new gpAx1(); if (Dependency[0].Name == InterpreterNames.Reference) { var circleLocation = Dependency[0].RefTransformedPoint3D.GpPnt; var pointBuilder = Dependency[0].ReferenceBuilder; var circleNormal = pointBuilder[0].Reference.Children[1].Get <Axis3DInterpreter>().Axis.Direction; centerAxis = new gpAx1(circleLocation, new gpDir(circleNormal.GpPnt.XYZ).Transformed(transform)); ax2.Axis = (centerAxis); } if (Dependency[0].Name == InterpreterNames.Axis3D) { centerAxis = Dependency[0].TransformedAxis3D; ax2.Axis = (centerAxis); } var circleCenter = centerAxis; var pointOnCircle = GetPointOnCircle(centerAxis, Dependency[1].Real, transform); var radius = pointOnCircle.Distance(circleCenter.Location); var leftArrowVector = new gpVec(circleCenter.Location, pointOnCircle); leftArrowVector.Normalize(); leftArrowVector.Multiply(radius + DistanceToObject); var leftArrowLocation = circleCenter.Location.Translated(leftArrowVector); var rightArrowVector = leftArrowVector.Reversed; var rightArrowLocation = circleCenter.Location.Translated(rightArrowVector); var topArrowVector = new gpVec(leftArrowVector.XYZ); topArrowVector.Cross(new gpVec(ax2.Direction)); topArrowVector.Normalize(); topArrowVector.Multiply(radius + DistanceToObject); var topArrowLocation = circleCenter.Location.Translated(topArrowVector); var bottomArrowVector = topArrowVector.Reversed; var bottomArrowLocation = circleCenter.Location.Translated(bottomArrowVector); switch (index) { case 0: ax2.Location = (leftArrowLocation); ax2.XDirection = (new gpDir(leftArrowVector)); return(ax2); case 1: ax2.Location = (topArrowLocation); ax2.XDirection = (new gpDir(topArrowVector)); return(ax2); case 2: ax2.Location = (rightArrowLocation); ax2.XDirection = (new gpDir(rightArrowVector)); return(ax2); case 3: ax2.Location = (bottomArrowLocation); ax2.XDirection = (new gpDir(bottomArrowVector)); return(ax2); default: return(null); } }