コード例 #1
0
        public void SetTransformationTestRotationAndTranslation()
        {
            var originBaseSketch   = new gpPnt(1, 1, 0);
            var originSecondSketch = new gpPnt(10, 1, 0);
            var T             = new gpTrsf();
            var oldSystemAxis = new gpAx3(originBaseSketch, new gpDir(0, 0, 1));
            var newSystemAxis = new gpAx3(originSecondSketch, new gpDir(1, 0, 0));

            T.SetTransformation(oldSystemAxis, newSystemAxis);

            var point = new gpPnt(10, 3, 8).Transformed(T);

            var translationPart = new gpTrsf();

            translationPart.SetTranslation(new gpPnt(0, 0, 0), point);
            gpTrsf mult1 = T.Inverted.Multiplied(translationPart);
            var    try1  = new gpPnt(0, 0, 0).Transformed(mult1); // ok

            Assert.AreEqual(try1.X, 10);
            Assert.AreEqual(try1.Y, 3);
            Assert.AreEqual(try1.Z, 8);
            gpTrsf mult2 = translationPart.Multiplied(T.Inverted);
            var    try2  = new gpPnt(0, 0, 0).Transformed(mult2); // nok

            Assert.AreEqual(try2.X, 17);
            Assert.AreEqual(try2.Y, -3);
            Assert.AreEqual(try2.Z, 1);
        }
コード例 #2
0
        public void SetTransformationTestMultipleTrsf()
        {
            var originBaseSketch   = new gpPnt(1, 1, 0);
            var originSecondSketch = new gpPnt(10, 1, 0);

            var T             = new gpTrsf();
            var oldSystemAxis = new gpAx3(originBaseSketch, new gpDir(0, 0, 1));
            var newSystemAxis = new gpAx3(originSecondSketch, new gpDir(1, 0, 0));

            T.SetTransformation(oldSystemAxis, newSystemAxis);

            var point = new gpPnt(10, 3, 8).Transformed(T);

            var translationPart = new gpTrsf();

            translationPart.SetTranslation(new gpPnt(0, 0, 0), point);
            gpTrsf mult1 = T.Inverted.Multiplied(translationPart);
            var    try1  = new gpPnt(0, 0, 0).Transformed(mult1); // ok: transformations needed to obtain global point (10, 3, 8)

            Assert.AreEqual(try1.X, 10);
            Assert.AreEqual(try1.Y, 3);
            Assert.AreEqual(try1.Z, 8);

            //reversed order doesn't work
            gpTrsf mult2 = translationPart.Multiplied(T.Inverted);
            var    try2  = new gpPnt(0, 0, 0).Transformed(mult2);

            Assert.AreEqual(try2.X, 17);
            Assert.AreEqual(try2.Y, -3);
            Assert.AreEqual(try2.Z, 1);

            //translate entire 'object'
            var translation1 = new gpTrsf();

            translation1.SetTranslation(new gpPnt(1, 1, 0), new gpPnt(7, 1, 0));
            var multipleTrsfs = translation1.Multiplied(mult1);
            var try11         = new gpPnt(0, 0, 0).Transformed(multipleTrsfs);

            Assert.AreEqual(try11.X, 16);
            Assert.AreEqual(try11.Y, 3);
            Assert.AreEqual(try11.Z, 8);

            //reversed order doesn't work
            var multipleTrsfs2 = mult1.Multiplied(translation1);
            var try12          = new gpPnt(0, 0, 0).Transformed(multipleTrsfs2);

            Assert.AreEqual(try12.X, 10);
            Assert.AreEqual(try12.Y, 3);
            Assert.AreEqual(try12.Z, 14);
        }
コード例 #3
0
        private static void ApplyTranslate(gpPnt currentLocation, Point3D increment, Node sketchNode)
        {
            var currentAxis = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode));

            var trsfCurrent = sketchNode.Get <TransformationInterpreter>().CurrTransform;
            var newPosition = new Point3D(currentAxis.Location.X + increment.X,
                                          currentAxis.Location.Y + increment.Y,
                                          currentAxis.Location.Z + increment.Z);
            var    newSystemAxis = new gpAx3(newPosition.GpPnt, currentAxis.Direction);
            gpTrsf T             = new gpTrsf();

            T.SetDisplacement(new gpAx3(currentAxis.Location, currentAxis.Direction), newSystemAxis);

            trsfCurrent = T.Multiplied(trsfCurrent);
            sketchNode.Set <TransformationInterpreter>().CurrTransform = trsfCurrent;
            var nb = new NodeBuilder(sketchNode);

            nb.ExecuteFunction();
        }
コード例 #4
0
        public void SetTransformationTestTranslationOnZ()
        {
            var originBaseSketch   = new gpPnt(1, 1, 0);
            var originSecondSketch = new gpPnt(2, 2, 10);
            var T             = new gpTrsf();
            var oldSystemAxis = new gpAx3(originBaseSketch, new gpDir(0, 0, 1));
            var newSystemAxis = new gpAx3(originSecondSketch, new gpDir(0, 0, 1));

            T.SetTransformation(oldSystemAxis, newSystemAxis);
            var secondOriginTransformed = originSecondSketch.Transformed(T);

            Assert.AreEqual(secondOriginTransformed.X, originBaseSketch.X);
            Assert.AreEqual(secondOriginTransformed.Y, originBaseSketch.Y);
            Assert.AreEqual(secondOriginTransformed.Z, originBaseSketch.Z);
            var point = new gpPnt(2, 3, 10).Transformed(T);

            Assert.AreEqual(point.X, 1);
            Assert.AreEqual(point.Y, 2);
            Assert.AreEqual(point.Z, 0);
        }
コード例 #5
0
        public override void UpdatePointPosition(int index, Mouse3DPosition vertex)
        {
            if (SelectedEntity.TargetShape() == null)
            {
                return;
            }
            var  faceToChangeIndex = 0;
            Node nodeToChange      = null;
            var  faceShape         = new TopoDSShape();

            if (SelectedEntity.Node.Get <FunctionInterpreter>().Name == FunctionNames.Cut)
            {
                var nb             = new NodeBuilder(SelectedEntity.Node);
                var affectedShapes = NodeBuilderUtils.GetCutNodeBaseExtrudeNodes(nb).ToList();//nb.Dependency[3];
                var clickedPlane   = GeomUtils.ExtractPlane(SelectedEntity.TargetShape());
                if (clickedPlane == null)
                {
                    return;
                }
                foreach (var node in affectedShapes)
                {
                    var faces = GeomUtils.ExtractFaces(new NodeBuilder(node).Shape);
                    int count = 1;
                    foreach (var face in faces)
                    {
                        var direction = GeomUtils.ExtractPlane(face);
                        if (direction == null)
                        {
                            count++;
                            continue;
                        }
                        count++;
                        if (direction.Axis.Direction.IsParallel(clickedPlane.Axis.Direction, Precision.Confusion))
                        {
                            var projectedPnt = GeomUtils.ProjectPointOnPlane(direction.Location, clickedPlane, Precision.Confusion);
                            if (projectedPnt.IsEqual(direction.Location, Precision.Confusion))
                            {
                                faceShape = face;
                                break;
                            }
                        }
                    }

                    // if the face matches the clicked plane, count will be > 0 and will hold the face index on the extruded solid
                    if (count > 0)
                    {
                        faceToChangeIndex = count - 1;
                        nodeToChange      = node;
                        break;
                    }
                }
            }
            if (SelectedEntity.Node.Get <FunctionInterpreter>().Name == FunctionNames.Extrude)
            {
                faceToChangeIndex = SelectedEntity.ShapeCount;
                nodeToChange      = SelectedEntity.Node;
                faceShape         = SelectedEntity.TargetShape();
            }

            if (prevFaceCount < 0)
            {
                prevFaceCount = faceToChangeIndex;
            }
            if (faceToChangeIndex != prevFaceCount)
            {
                return;
            }
            if (nodeToChange == null)
            {
                return;
            }
            var distance      = 0.0;
            var numberOfFaces = GeomUtils.ExtractFaces(new NodeBuilder(nodeToChange).Shape).Count;

            if (faceToChangeIndex == numberOfFaces) //top of shape
            {
                distance = GeomUtils.CalculateDistance(vertex.Point.GpPnt,
                                                       new NodeBuilder(nodeToChange).Dependency[0].
                                                       ReferenceBuilder.Shape);

                var extrudeNb = new NodeBuilder(nodeToChange);
                if (Math.Abs(distance) < Precision.Confusion)
                {
                    distance = 0.1;
                }
                extrudeNb.Dependency[2].Real = distance;
                extrudeNb.ExecuteFunction();
            }

            if (faceToChangeIndex == (numberOfFaces - 1))
            {
                // bottom of shape - sketch which was extruded
                var extrudeNb       = new NodeBuilder(nodeToChange);
                var extrudeHeight   = extrudeNb.Dependency[2].Real;
                var baseSketch      = extrudeNb.Dependency[0].ReferenceBuilder;
                var faces           = GeomUtils.ExtractFaces(extrudeNb.Shape);
                var topFace         = faces[numberOfFaces - 1];
                var distanceTopFace = GeomUtils.CalculateDistance(vertex.Point.GpPnt,
                                                                  topFace);
                distance = GeomUtils.CalculateDistance(vertex.Point.GpPnt,
                                                       SelectedEntity.TargetShape());

                var dirBottomFace         = GeomUtils.ExtractDirection(SelectedEntity.TargetShape());
                var orientationBottomFace = SelectedEntity.TargetShape().Orientation();
                if (orientationBottomFace != TopAbsOrientation.TopAbs_REVERSED)
                {
                    dirBottomFace.Reverse();
                }
                var bottomFaceGravityCenter = GeomUtils.ExtractGravityCenter(topFace);
                var vertexOnDir             = TransformationInterpreter.ProjectPointOnLine(bottomFaceGravityCenter,
                                                                                           dirBottomFace, vertex.Point).Value;
                var startPointOnDir = TransformationInterpreter.ProjectPointOnLine(bottomFaceGravityCenter,
                                                                                   dirBottomFace, new Point3D(previousMousePosition)).Value;

                var vertexvector = new gpVec(startPointOnDir.GpPnt, vertexOnDir.GpPnt);
                var normalvector = new gpVec(dirBottomFace);
                var isOpposite   = false;
                try
                {
                    isOpposite = vertexvector.IsOpposite(normalvector, Precision.Angular);
                }
                catch { return; }
                // calculate new height for the solid
                var newHeight = 0.0;
                if (isOpposite)
                {
                    newHeight = Math.Abs(extrudeHeight) - Math.Abs(distance);
                }
                else
                {
                    newHeight = Math.Abs(extrudeHeight) + Math.Abs(distance);
                }
                newHeight *= Math.Sign(extrudeHeight);
                var face = SelectedEntity.TargetShape();
                if (face == null)
                {
                    return;
                }

                // calculate the new position for the solid
                var transformation = baseSketch.Node.Get <TransformationInterpreter>().CurrTransform;
                var locationOld    = new gpPnt(0, 0, 0).Transformed(transformation);
                var shape          = SelectedEntity.TargetShape();

                var dir         = GeomUtils.ExtractDirection(shape);
                var orientation = shape.Orientation();
                if (orientation != TopAbsOrientation.TopAbs_REVERSED)
                {
                    dir.Reverse();
                }
                if (isOpposite)
                {
                    dir.Reverse();
                }

                var locationNew = new gpPnt
                {
                    X = locationOld.X + dir.X * Math.Abs(distance),
                    Y = locationOld.Y + dir.Y * Math.Abs(distance),
                    Z = locationOld.Z + dir.Z * Math.Abs(distance)
                };

                // set the new transformation for the base sketch
                var T             = new gpTrsf();
                var oldSystemAxis = new gpAx3(new gpPnt(0, 0, 0), new gpDir(0, 0, 1));
                var newSystemAxis = new gpAx3(locationNew, dir);
                T.SetTransformation(oldSystemAxis, newSystemAxis);

                var transformationSet = baseSketch.Node.Set <TransformationInterpreter>();
                transformationSet.CurrTransform = T.Inverted;

                extrudeNb.Dependency[2].Real = newHeight;
                baseSketch.ExecuteFunction();
                previousMousePosition = vertex.Point.GpPnt;
            }

            if (faceToChangeIndex < (numberOfFaces - 1))
            {
                var         shape           = faceShape;
                var         gravityCenter   = GeomUtils.ExtractGravityCenter(shape);
                var         extrudeNb       = new NodeBuilder(nodeToChange);
                var         baseSketch      = extrudeNb.Dependency[0].ReferenceBuilder;
                var         transformation  = baseSketch.Node.Get <TransformationInterpreter>().CurrTransform;
                var         locationSketch  = new gpPnt(0, 0, 0).Transformed(transformation);
                var         directionSketch = new gpDir(0, 0, 1).Transformed(transformation);
                var         sketchPlane     = new gpPln(locationSketch, directionSketch);
                var         pointOnPlane    = new Point3D(GeomUtils.ProjectPointOnPlane(gravityCenter.GpPnt, sketchPlane, Precision.Confusion));
                var         sketchNodes     = NodeUtils.GetSketchNodes(baseSketch.Node, baseSketch.Node.Root.Get <DocumentContextInterpreter>().Document, true);
                NodeBuilder draggedLine     = null;
                foreach (var node in sketchNodes)
                {
                    var nb = new NodeBuilder(node);
                    if (nb.FunctionName != FunctionNames.LineTwoPoints)
                    {
                        continue;
                    }
                    var edges = GeomUtils.ExtractEdges(nb.Shape);
                    if (edges.Count != 1)
                    {
                        continue;
                    }
                    if (GeomUtils.PointIsOnEdge(edges[0], pointOnPlane))
                    {
                        draggedLine = nb;
                        break;
                    }
                }

                if (draggedLine != null)
                {
                    var axisLength    = CoreGlobalPreferencesSingleton.Instance.ZoomLevel * 10;
                    var faceDirection = GeomUtils.ExtractDirection(shape);
                    var orientation   = shape.Orientation();
                    if (orientation != TopAbsOrientation.TopAbs_REVERSED)
                    {
                        faceDirection.Reverse();
                    }
                    var vertexOnPlane = new Point3D(GeomUtils.ProjectPointOnPlane(vertex.Point.GpPnt, sketchPlane, Precision.Confusion));

                    vertexOnPlane.X = (vertexOnPlane.X) * Math.Abs(faceDirection.X);
                    vertexOnPlane.Y = (vertexOnPlane.Y) * Math.Abs(faceDirection.Y);
                    vertexOnPlane.Z = (vertexOnPlane.Z) * Math.Abs(faceDirection.Z);
                    var pointOnPlaneAxis = new Point3D
                    {
                        X = pointOnPlane.X * Math.Abs(faceDirection.X),
                        Y = pointOnPlane.Y * Math.Abs(faceDirection.Y),
                        Z = pointOnPlane.Z * Math.Abs(faceDirection.Z)
                    };
                    var translateValue = vertexOnPlane.SubstractCoordinate(pointOnPlaneAxis);
                    NodeUtils.TranslateSketchNode(draggedLine, translateValue, baseSketch.Node);
                    var constraintMapper = new ConstraintDocumentHelper(baseSketch.Node.Root.Get <DocumentContextInterpreter>().Document, baseSketch.Node);
                    constraintMapper.SetMousePosition(draggedLine.Dependency[0].Reference.Index);
                    var error = constraintMapper.ImpactAndSolve(draggedLine.Dependency[1].Node.Get <ReferenceInterpreter>().Node);
                    baseSketch.ExecuteFunction();
                    extrudeNb.Color = solidColor;
                    extrudeNb.ExecuteFunction();
                }
            }
        }
コード例 #6
0
 public static void TorusParameters(gpAx3 Pos, double MajorRadius, double MinorRadius, gpPnt P, ref double U, ref double V)
 {
     ElSLib_TorusParametersE2117665(Pos.Instance, MajorRadius, MinorRadius, P.Instance, ref U, ref V);
 }
コード例 #7
0
 public void SetTransformation(gpAx3 FromSystem1, gpAx3 ToSystem2)
 {
     Geom_Transformation_SetTransformationB5D8FD04(Instance, FromSystem1.Instance, ToSystem2.Instance);
 }
コード例 #8
0
 public void SetTransformation(gpAx3 ToSystem)
 {
     Geom_Transformation_SetTransformation1B3CAD05(Instance, ToSystem.Instance);
 }
コード例 #9
0
 public static void CylinderParameters(gpAx3 Pos, double Radius, gpPnt P, ref double U, ref double V)
 {
     ElSLib_CylinderParameters2262D7A7(Pos.Instance, Radius, P.Instance, ref U, ref V);
 }
コード例 #10
0
 public static void ConeParameters(gpAx3 Pos, double Radius, double SAngle, gpPnt P, ref double U, ref double V)
 {
     ElSLib_ConeParametersE2117665(Pos.Instance, Radius, SAngle, P.Instance, ref U, ref V);
 }
コード例 #11
0
 public static gpLin ConeUIso(gpAx3 Pos, double Radius, double SAngle, double U)
 {
     return(new gpLin(ElSLib_ConeUIso649F02B6(Pos.Instance, Radius, SAngle, U)));
 }
コード例 #12
0
 public static void PlaneParameters(gpAx3 Pos, gpPnt P, ref double U, ref double V)
 {
     ElSLib_PlaneParametersC11F2078(Pos.Instance, P.Instance, ref U, ref V);
 }
コード例 #13
0
 public static gpPnt ConeValue(double U, double V, gpAx3 Pos, double Radius, double SAngle)
 {
     return(new gpPnt(ElSLib_ConeValue5CAF831A(U, V, Pos.Instance, Radius, SAngle)));
 }
コード例 #14
0
 public GeomPlane(gpAx3 A3)
     :
     base(Geom_Plane_Ctor1B3CAD05(A3.Instance))
 {
 }
コード例 #15
0
 public static gpPnt PlaneValue(double U, double V, gpAx3 Pos)
 {
     return(new gpPnt(ElSLib_PlaneValueCFBE1681(U, V, Pos.Instance)));
 }
コード例 #16
0
 public static gpCirc TorusVIso(gpAx3 Pos, double MajorRadius, double MinorRadius, double V)
 {
     return(new gpCirc(ElSLib_TorusVIso649F02B6(Pos.Instance, MajorRadius, MinorRadius, V)));
 }
コード例 #17
0
 public static gpCirc SphereVIso(gpAx3 Pos, double Radius, double V)
 {
     return(new gpCirc(ElSLib_SphereVIso32BF0691(Pos.Instance, Radius, V)));
 }
コード例 #18
0
 public static gpCirc ConeVIso(gpAx3 Pos, double Radius, double SAngle, double V)
 {
     return(new gpCirc(ElSLib_ConeVIso649F02B6(Pos.Instance, Radius, SAngle, V)));
 }
コード例 #19
0
 public static gpLin PlaneVIso(gpAx3 Pos, double V)
 {
     return(new gpLin(ElSLib_PlaneVIso5C6D1CB8(Pos.Instance, V)));
 }
コード例 #20
0
 public static gpPnt SphereValue(double U, double V, gpAx3 Pos, double Radius)
 {
     return(new gpPnt(ElSLib_SphereValueBACDEA69(U, V, Pos.Instance, Radius)));
 }
コード例 #21
0
 public static gpLin CylinderUIso(gpAx3 Pos, double Radius, double U)
 {
     return(new gpLin(ElSLib_CylinderUIso32BF0691(Pos.Instance, Radius, U)));
 }
コード例 #22
0
 public static gpPnt TorusValue(double U, double V, gpAx3 Pos, double MajorRadius, double MinorRadius)
 {
     return(new gpPnt(ElSLib_TorusValue5CAF831A(U, V, Pos.Instance, MajorRadius, MinorRadius)));
 }
コード例 #23
0
        /// <summary>
        /// A new sketch is created: if the user clicked on the face of a solid, that face's normal is used as axis for the new sketch, otherwise
        /// the default axis with position (0,0,0) and direction (0,0,1) is used.
        /// </summary>
        /// <param name="mouseData"></param>
        protected override void OnMouseDownAction(Mouse3DPosition mouseData)
        {
            base.OnMouseDownAction(mouseData);

            Log.Info("StartSketch - OnMouseDownAction");

            //var checkSketch = new SketchCreator(Document, false);
            //if (checkSketch.CurrentSketch != null) return;
            Log.Info("StartSketch - OnMouseDownAction - current sketch null");

            var sketchCreator     = new SketchCreator(Document);
            var currentSketch     = sketchCreator.CurrentSketch;
            var sketchNodeBuilder = new NodeBuilder(currentSketch);

            Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.BuildSelections, mouseData);
            var entities =
                Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get
                <List <SceneSelectedEntity> >();

            var selectedFace = (SelectionInfo)Inputs[InputNames.Mouse3DEventsPipe].GetData(NotificationNames.GetFace).Data;

            Document.Transact();
            var transformationInfo = new TransformationInfo();

            transformationInfo.SketchIndex = sketchNodeBuilder.Node.Index;
            Log.InfoFormat("StartSketch - OnMouseDownAction - selected entities count {0}", entities.Count);
            var normalOnPlane = new Axis(new Point3D(0, 0, 0), new Point3D(0, 0, 1)).GpAxis;

            if (Inputs[InputNames.Mouse3DEventsPipe].GetData(NotificationNames.GetPlane).Data != null)
            {
                normalOnPlane.Location =
                    ((gpPln)Inputs[InputNames.Mouse3DEventsPipe].GetData(NotificationNames.GetPlane).Data).Axis.Location;
                normalOnPlane.Direction =
                    ((gpPln)Inputs[InputNames.Mouse3DEventsPipe].GetData(NotificationNames.GetPlane).Data).Axis.Direction;
                if (selectedFace != null)
                {
                    var _3DShapesFunctions = new List <string>();
                    _3DShapesFunctions.AddRange(new[] { FunctionNames.Sphere, FunctionNames.Box, FunctionNames.Cylinder,
                                                        FunctionNames.Torus, FunctionNames.Cone, FunctionNames.Plane });
                    var nb = new NodeBuilder(selectedFace.selectedNode);
                    if (nb.FunctionName == string.Empty || _3DShapesFunctions.Contains(nb.FunctionName))
                    {
                        transformationInfo.RefSketchIndex = -1;
                    }
                    else
                    {
                        transformationInfo.RefSketchIndex = nb.Dependency[0].Reference.Index;
                        var faces       = GeomUtils.ExtractFaces(nb.Shape);
                        var face        = faces[selectedFace.face];
                        var orientation = face.Orientation();
                        if (orientation == TopAbsOrientation.TopAbs_REVERSED)
                        {
                            normalOnPlane.Direction = normalOnPlane.Direction.Reversed;
                        }
                    }
                }
                else
                {
                    transformationInfo.RefSketchIndex = -1;
                }
            }
            else
            {
                var plane = new gpPln(new gpAx3());
                Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.SetPlane, plane);
                transformationInfo.RefSketchIndex = -1;
            }

            if (selectedFace != null)
            {
                var nb = new NodeBuilder(selectedFace.selectedNode);
                if (nb.FunctionName != FunctionNames.Plane)
                {
                    sketchNodeBuilder[2].Reference = nb.Node;
                    sketchNodeBuilder[3].Integer   = selectedFace.face;
                }
            }
            _sketchButton.Block();

            sketchNodeBuilder[0].TransformedAxis3D = new Axis(new Point3D(0, 0, 0), new Point3D(0, 0, 1)).GpAxis;
            var transformation = sketchNodeBuilder.Node.Set <TransformationInterpreter>();

            if (selectedFace != null)
            {
                var solids = new List <string> {
                    string.Empty
                };
                solids.AddRange(FunctionNames.GetSolids());
                if (solids.Contains(new NodeBuilder(selectedFace.selectedNode).FunctionName))
                {
                    var    oldSystemAxis = new gpAx3(new gpPnt(0, 0, 0), new gpDir(0, 0, 1));
                    var    newSystemAxis = new gpAx3(normalOnPlane.Location, normalOnPlane.Direction);
                    gpTrsf T             = new gpTrsf();
                    T.SetTransformation(oldSystemAxis, newSystemAxis);
                    transformation.CurrTransform = T.Inverted;
                }
                else
                {
                    var allTrsfs =
                        NodeBuilderUtils.GetTransformedAxis(
                            new NodeBuilder(selectedFace.selectedNode).Dependency[0].ReferenceBuilder);
                    gpTrsf T             = new gpTrsf();
                    var    oldSystemAxis = new gpAx3(new gpPnt(0, 0, 0), new gpDir(0, 0, 1));
                    //  var oldSystemAxis = new gpAx3(allTrsfs.Location, allTrsfs.Direction);
                    normalOnPlane.Direction = NodeBuilderUtils.RoundToPrecision(normalOnPlane.Direction);
                    var newSystemAxis = new gpAx3(normalOnPlane.Location, normalOnPlane.Direction);
                    // T.SetDisplacement(oldSystemAxis, newSystemAxis);
                    T.SetTransformation(oldSystemAxis, newSystemAxis);
                    transformation.CurrTransform = T.Inverted;
                }
                transformationInfo.Transformation = transformation.CurrTransform;
            }
            else
            {
                transformation.TranslateWith(new Point3D(normalOnPlane.Location));
                transformationInfo.Transformation = transformation.CurrTransform;
            }
            transformationInfo.TrsfIndex = TransformationInfo.maxTrsfIndex;
            TransformationInfo.maxTrsfIndex++;
            TransformationInterpreter.Transformations.Add(transformationInfo);

            sketchNodeBuilder.ExecuteFunction();

            AddNodeToTree(sketchNodeBuilder.Node);
            NodeBuilderUtils.HidePlanes(Document);
            HighlightCurrentSketchNodes(sketchNodeBuilder.Node);
            Document.Commit("sketch created");
            BackToNeutralModifier();
        }