public static void TranslateSketchNode(NodeBuilder nodeBuilder, Point3D translateValue, Node sketchNode)//, gpTrsf translation) { if (nodeBuilder.FunctionName == FunctionNames.Point) { gpTrsf translation = new gpTrsf(); var sketchAxisLocation = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)).Location; var newValue = new Point3D(sketchAxisLocation.X + translateValue.X, sketchAxisLocation.Y + translateValue.Y, sketchAxisLocation.Z + translateValue.Z); translation.SetTranslation(sketchAxisLocation, newValue.GpPnt); nodeBuilder.Node.Set <TransformationInterpreter>().CurrTransform = translation; nodeBuilder.ExecuteFunction(); } else { var affectedPoints = GetPointNodes(nodeBuilder.Node); if (affectedPoints == null) { return; } var sketchAxisLocation = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)).Location; foreach (var point in affectedPoints) { var nb = new NodeBuilder(point); var oldValue = nb[1].TransformedPoint3D; var newValue = new Point3D(oldValue.X + translateValue.X, oldValue.Y + translateValue.Y, oldValue.Z + translateValue.Z); var translation = new gpTrsf(); translation.SetTranslation(sketchAxisLocation, newValue.GpPnt); nb.Node.Set <TransformationInterpreter>().CurrTransform = translation; nb.ExecuteFunction(); } } }
public override bool Execute() { var axis = NodeBuilderUtils.GetTransformedAxis(Dependency[0].ReferenceBuilder); var zoomLevel = CoreGlobalPreferencesSingleton.Instance.ZoomLevel; Shape = OccShapeCreatorCode.CreateCircle(axis, zoomLevel); return(true); }
private void AddNewPoint(Point3D coordinate) { if (Points.Count == 2 && Points[0].IsEqual(coordinate)) { return; } SetCoordinate(coordinate); AddNewEmptyPoint(); if (Points.Count <= 2) { return; } var builder = BuildLine(); AddNodeToTree(builder.Node); Hinter2D.SetOrigin(builder[0].RefTransformedPoint3D); Hinter2D.Populate(); Hinter2D.ApplyAlgorithms(new NodeBuilder(builder[0].Reference)); Hinter2D.ApplyAlgorithms(new NodeBuilder(builder[1].Reference)); var axis = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)); var result = Hinter2D.ApplyAlgorithms(builder); var constraints = new List <NodeBuilder>(); foreach (var res in result) { constraints.AddRange(res.constraintNodes); } foreach (var constraint in constraints) { if (constraint.FunctionName == Constraint2DNames.ParallelFunction || constraint.FunctionName == Constraint2DNames.PerpendicularFunction) { var secondNode = constraint.Dependency[0].Reference.Index == builder.Node.Index ? constraint.Dependency[1].Reference : constraint.Dependency[0].Reference; NodeBuilderUtils.AdddHintsForNode(Document, secondNode, constraint.Node, axis); } } var sseList = constraints.Select(c => new SceneSelectedEntity(c.Node)).ToList(); var newNode = new NodeBuilder(Document, FunctionNames.LineHints); newNode[0].Reference = builder.Node; newNode[1].ReferenceList = sseList; newNode[2].Axis3D = new Axis(axis); newNode.Color = Color.Black; newNode.Node.Set <TransformationInterpreter>().Translate = new gpPnt(); if (!newNode.ExecuteFunction()) { Document.Root.Remove(newNode.Node.Index); } CommitFinal("Added line to scene"); UpdateView(); Reset(); Inputs[InputNames.UiElementsItem].Send(NotificationNames.SelectNode, builder.Node); }
private List <NodeBuilder> PreviewRectangleLines(Document document, Node sketchNode) { _firstPoint = Points[0]; _secondPoint = Points[1]; if (_firstPoint.IsEqual(_secondPoint)) { return(null); } // var axis1 = new gpAx2(); // axis1.Axis = (sketchNode.Children[1].Get<Axis3DInterpreter>().Axis.GpAxis); //// var transformedAxsi = axis1.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); // var location = axis1.Axis.Location.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); // var direction = axis1.Axis.Direction.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); // var sketchNodeBuilder = new NodeBuilder(sketchNode); // var axisBase = new gpAx1(location, direction); // if (sketchNodeBuilder.Dependency[2].ReferenceBuilder != null && // sketchNodeBuilder.Dependency[2].ReferenceBuilder.Node != null) // { // var baseSketch = // new NodeBuilder(sketchNodeBuilder.Dependency[2].ReferenceBuilder.Node).Dependency[0].ReferenceBuilder; // axisBase = axisBase.Transformed(baseSketch.Node.Get<TransformationInterpreter>().CurrTransform); // } // //var axis = new gpAx2(location, direction); // var axis = new gpAx2(axisBase.Location, axisBase.Direction); // var axis = new gpAx2(axis1.Location, axis1.Direction); var axisAll = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)); var axis = new gpAx2(axisAll.Location, axisAll.Direction); var point3Ds = new List <Point3D>(); var firstPoint2D = _firstPoint.ToPoint2D(axis); var secondPoint2D = _secondPoint.ToPoint2D(axis); var x1 = firstPoint2D.X; var y1 = firstPoint2D.Y; var x2 = secondPoint2D.X; var y2 = secondPoint2D.Y; point3Ds.Add(GeomUtils.Point2DTo3D(axis, x1, y1)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, x2, y1)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, x2, y2)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, x1, y2)); var pointLinker = new SketchCreator(document).PointLinker; var lines = new List <NodeBuilder> { BuildLine(Document, pointLinker, point3Ds[0], point3Ds[1]), BuildLine(Document, pointLinker, point3Ds[1], point3Ds[2]), BuildLine(Document, pointLinker, point3Ds[2], point3Ds[3]), BuildLine(Document, pointLinker, point3Ds[3], point3Ds[0]) }; return(lines); }
private List <NodeBuilder> PreviewRectangle(Document document, Node sketchNode) { //var axis1 = new gpAx2(); //axis1.Axis = (sketchNode.Children[1].Get<Axis3DInterpreter>().Axis.GpAxis); //var location = axis1.Axis.Location.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); //var direction = axis1.Axis.Direction.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); //var axis = new gpAx2(location, direction); var axisAll = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)); var axis = new gpAx2(axisAll.Location, axisAll.Direction); var vec = new gpVec(Points[0].GpPnt, Points[1].GpPnt); gpVec v2 = vec.Normalized; v2.Rotate(axis.Axis, Math.PI / 2.0); var parallelLine = new gceMakeLin(Points[1].GpPnt, new gpDir(v2)).Value; var geomLine = new GeomLine(parallelLine); var projectionPoint = new GeomAPIProjectPointOnCurve(Points[2].GpPnt, geomLine); var thirdPoint = new Point3D(projectionPoint.NearestPoint); var firstPoint2D = Points[0].ToPoint2D(axis); var secondPoint2D = Points[1].ToPoint2D(axis); var thirdPoint2D = thirdPoint.ToPoint2D(axis); var parallelLine2 = new gceMakeLin(Points[2].GpPnt, new gpDir(vec)).Value; var geomLine2 = new GeomLine(parallelLine2); var projectionPoint2 = new GeomAPIProjectPointOnCurve(Points[0].GpPnt, geomLine2); var fourthPoint = new Point3D(projectionPoint2.NearestPoint); var fourthPoint2D = fourthPoint.ToPoint2D(axis); var point3Ds = new List <Point3D>(); point3Ds.Add(GeomUtils.Point2DTo3D(axis, firstPoint2D.X, firstPoint2D.Y)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, secondPoint2D.X, secondPoint2D.Y)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, thirdPoint2D.X, thirdPoint2D.Y)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, fourthPoint2D.X, fourthPoint2D.Y)); var pointLinker = new SketchCreator(document).PointLinker; var lines = new List <NodeBuilder> { BuildLine(Document, pointLinker, point3Ds[0], point3Ds[1]), BuildLine(Document, pointLinker, point3Ds[1], point3Ds[2]), BuildLine(Document, pointLinker, point3Ds[2], point3Ds[3]), BuildLine(Document, pointLinker, point3Ds[3], point3Ds[0]) }; return(lines); }
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(); }
public override bool Execute() { var pointBuilder = Dependency[0].ReferenceBuilder; var sketchNode = pointBuilder.Dependency[0].ReferenceBuilder; var sketchAxis = NodeBuilderUtils.GetTransformedAxis(sketchNode); var centerAxis = new Axis { Location = pointBuilder[1].TransformedPoint3D, Direction = new Point3D(sketchAxis.Direction.X, sketchAxis.Direction.Y, sketchAxis.Direction.Z) }; var startPoint = Dependency[1].ReferenceBuilder[1].TransformedPoint3D; var endPoint = Dependency[2].ReferenceBuilder[1].TransformedPoint3D; var topoShape = GeomUtils.CreateArcWire(centerAxis.GpAxis, startPoint, endPoint, true); Shape = topoShape; return(true); }
public override bool Execute() { var radius = Dependency[1].Real; if (radius < Precision.Confusion) { return(false); } var pointBuilder = Dependency[0].ReferenceBuilder; var sketchNode = pointBuilder.Dependency[0].ReferenceBuilder; var transformedAxis = NodeBuilderUtils.GetTransformedAxis(sketchNode); var centerAxis = new Axis { Location = pointBuilder[1].TransformedPoint3D, Direction = new Point3D(transformedAxis.Direction.X, transformedAxis.Direction.Y, transformedAxis.Direction.Z) }; var topoShape = OccShapeCreatorCode.CreateWireCircle(centerAxis.GpAxis, radius); Shape = topoShape; return(true); }
private void UpdatePoints() { var root = this.Builder.Node.Root; var pointNodes = from node in root.ChildrenList let builder = new NodeBuilder(node) where builder.FunctionName == FunctionNames.Point let currentSketchNode = AutoGroupLogic.FindSketchNode(node) where currentSketchNode.Index == this.Builder.Node.Index select node; var points = pointNodes.ToList(); var sketchAx2 = new gpAx2 { Axis = NodeBuilderUtils.GetTransformedAxis(Builder) }; var sketchPlane = new gpPln(new gpAx3(sketchAx2)); foreach (var point in points) { var nb = new NodeBuilder(point); var current = nb[1].TransformedPoint3D; var projectedPlane = GeomUtils.ProjectPointOnPlane(current.GpPnt, sketchPlane, Precision.Confusion); nb[1].TransformedPoint3D = new Point3D(projectedPlane); nb.ExecuteFunction(); } }
private void PreviewRectangleLines(Document document, Node sketchNode) { _firstPoint = Points[0]; _secondPoint = Points[1]; if (_firstPoint.IsEqual(_secondPoint)) { return; } if (Points.Count == 2) { // var axis1 = new gpAx2(); // axis1.Axis = (sketchNode.Children[1].Get<Axis3DInterpreter>().Axis.GpAxis); //var location = axis1.Axis.Location.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); //var direction = axis1.Axis.Direction.Transformed(sketchNode.Get<TransformationInterpreter>().CurrTransform); var axisAll = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)); // var axis = new gpAx2(location, direction); var axis = new gpAx2(axisAll.Location, axisAll.Direction); var point3Ds = new List <Point3D>(); var firstPoint2D = _firstPoint.ToPoint2D(axis); var secondPoint2D = _secondPoint.ToPoint2D(axis); var x1 = firstPoint2D.X; var y1 = firstPoint2D.Y; var x2 = secondPoint2D.X; var y2 = secondPoint2D.Y; point3Ds.Add(GeomUtils.Point2DTo3D(axis, x1, y1)); point3Ds.Add(GeomUtils.Point2DTo3D(axis, x2, y2)); var pointLinker = new SketchCreator(Document).PointLinker; BuildLine(document, pointLinker, point3Ds[0], point3Ds[1]); } if (Points.Count == 3) { PreviewRectangle(Document, _sketchNode); } }
public int Solve() { if (!_shapeList.Any() || !_constraints.Any()) { return(0); } // transform parameters var sketchNode = AutoGroupLogic.FindSketchNode(_document.Root[_shapeList.First()]); var axisAll = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)); var sketchAx2 = new gpAx2(axisAll.Location, axisAll.Direction); LoadParameters(sketchAx2); LoadConstraints(); if (SetConstraintsList.Size == 0) { return(0); } var freeParametersCount = 1; var maxFreeParametersCount = Parameters.Count - 2; var error = 1; var dfpSolver = new DFPSolver(); while (error == 1 && freeParametersCount <= maxFreeParametersCount) { error = dfpSolver.SolveRef(ref Parameters, freeParametersCount, ConstraintList, 1); freeParametersCount++; } Sketch2DSolver solver; if (error == 1) { var bfgsSolver = new BFGSSolver(); freeParametersCount = 1; while (error == 1 && freeParametersCount <= maxFreeParametersCount) { error = bfgsSolver.SolveRef(ref Parameters, freeParametersCount, ConstraintList, 1); freeParametersCount++; } solver = bfgsSolver; } else { solver = dfpSolver; } if (error == 0) { // update point position with the values returned by the solver int index = 0; foreach (var shape in ShapeToParamIndex.Keys) { //if (index > maxFreeParametersCount) // break; var nodeBuilder = new NodeBuilder(_document.Root[shape]); if (nodeBuilder.FunctionName == FunctionNames.Point) { nodeBuilder[1].TransformedPoint3D = GeomUtils.Point2DTo3D(sketchAx2, Parameters[ShapeToParamIndex[shape]], Parameters[ ShapeToParamIndex[shape] + 1]); index += 2; } if (nodeBuilder.FunctionName == FunctionNames.Circle) { nodeBuilder[0].RefTransformedPoint3D = GeomUtils.Point2DTo3D(sketchAx2, Parameters[ShapeToParamIndex[shape]], Parameters[ShapeToParamIndex[shape] + 1]); nodeBuilder[1].Real = Parameters[ShapeToParamIndex[shape] + 2]; index += 3; } } foreach (var shape in _document.Root.Children) { //if (index > maxFreeParametersCount) // break; var nodeBuilder = new NodeBuilder(shape.Value); if (nodeBuilder.FunctionName == FunctionNames.Arc) { if (ShapeToParamIndex.Keys.Contains(nodeBuilder.Dependency[0].Reference.Index)) { var centre = nodeBuilder.Dependency[0].RefTransformedPoint3D; var start = nodeBuilder.Dependency[1].RefTransformedPoint3D; var currentEnd = nodeBuilder.Dependency[2].RefTransformedPoint3D; var newEnd = GeomUtils.ProjectPointOnCircle(centre, start, currentEnd); if (newEnd != null) { var End = new Point3D(newEnd); nodeBuilder[2].RefTransformedPoint3D = new Point3D(End.X, End.Y, End.Z); } } error = 1; freeParametersCount = 0; while (error == 1 && freeParametersCount <= maxFreeParametersCount) { error = solver.SolveRef(ref Parameters, freeParametersCount, SetConstraintsList, 1); freeParametersCount += 2; } } } } foreach (var constr in softConstraints) { _document.Root.Remove(constr); } return(error); }
public static void Translate3DNode(NodeBuilder nodeBuilder, Document document, Point3D translateValue)//, Point3D oldValue) { { var list = NodeBuilderUtils.GetAllContained3DNodesIndexes(nodeBuilder.Node).Distinct().ToList(); var sketchNodes = new List <Node>(); //find if we are translating a stack of solids and if so, find the base solid foreach (var nodeIndex in list) { var node = document.Root[nodeIndex.Key]; var shapeNodeBuilder = new NodeBuilder(node); if (FunctionNames.GetSolids().Contains(nodeBuilder.FunctionName)) { continue; } var affectedSketchNode = shapeNodeBuilder.Dependency[0].ReferenceBuilder.Node; if (affectedSketchNode != null) { var nb1 = new NodeBuilder(affectedSketchNode); if (nb1.Dependency[2].Reference == null) { sketchNodes.Add(affectedSketchNode); } } } // if there are no stacked solids, find the base sketch for the solid we need to translate if (sketchNodes.Count == 0) { foreach (var nodeIndex in list) { var node = document.Root[nodeIndex.Key]; var shapeNodeBuilder = new NodeBuilder(node); if (FunctionNames.GetSolids().Contains(nodeBuilder.FunctionName)) { continue; } var affectedSketchNode = shapeNodeBuilder.Dependency[0].ReferenceBuilder.Node; if (affectedSketchNode != null) { sketchNodes.Add(affectedSketchNode); } } } if (sketchNodes.Count == 0) { return; } // use increments to avoid Cut occ bug foreach (var sketchNode in sketchNodes) { sketchNode.Set <DrawingAttributesInterpreter>().Disable(); var currentLocation = NodeBuilderUtils.GetTransformedAxis(new NodeBuilder(sketchNode)).Location; var currentValue = translateValue; while (Math.Abs(currentValue.X) > Precision.Confusion || Math.Abs(currentValue.Y) > Precision.Confusion || Math.Abs(currentValue.Z) > Precision.Confusion) { var currentTranslate = new Point3D(0, 0, 0); if (Math.Abs(currentValue.X) > 0) { if (Math.Abs(currentValue.X) < 10) { currentTranslate.X = currentValue.X; } else { currentTranslate.X = 10 * Math.Sign(currentValue.X); } currentValue.X -= currentTranslate.X; } if (Math.Abs(currentValue.Y) > 0) { if (Math.Abs(currentValue.Y) < 10) { currentTranslate.Y = currentValue.Y; } else { currentTranslate.Y = 10 * Math.Sign(currentValue.Y); } currentValue.Y -= currentTranslate.Y; } if (Math.Abs(currentValue.Z) > 0) { if (Math.Abs(currentValue.Z) < 10) { currentTranslate.Z = currentValue.Z; } else { currentTranslate.Z = 10 * Math.Sign(currentValue.Z); } currentValue.Z -= currentTranslate.Z; } ApplyTranslate(currentLocation, currentTranslate, sketchNode); } sketchNode.Set <DrawingAttributesInterpreter>().Enable(); } } }
/// <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(); }