Example #1
0
        protected override void OnMouseDownAction(Mouse3DPosition mouseData)
        {
            if (Points.Count == 0)
            {
                Points.Add(mouseData.Point);
                _firstCoordinateSet = true;
                Points.Add(new Point3D());
                return;
            }
            if (Points.Count == 2)
            {
                InitSession();
                var sketchCreator = new SketchCreator(Document);
                var normalOnPlane = sketchCreator.NormalOnSketch.Value.GpAxis;

                var builder = NodeBuilderUtils.BuildLineInDocument(Document, false, normalOnPlane, Points[0], Points[1]);

                NodeBuilderUtils.BuildDimensionForLine(Document, builder, Points[0], Points[1]);
                UpdateView();
                Points.Clear();
                AddNodeToTree(builder.Node);
                RebuildTreeView();
                Document.Commit("Added Dimension");
            }
        }
        private void PreviewLine()
        {
            InitSession();
            var builder = NodeBuilderUtils.BuildLineInDocument(Document, false, normalOnPlane, Points[0], Points[1]);

            PreviewLineInDocument(Document, Points[0], Points[1]);
            NodeBuilderUtils.BuildDimensionForLine(Document, builder, Points[0], Points[1]);
        }
Example #3
0
        protected override void OnMouseMove3DAction(Mouse3DPosition mouseData)
        {
            if (!_firstCoordinateSet || Points.Count < 2)
            {
                return;
            }

            Points[1] = mouseData.Point;
            if (Points[0].IsEqual(Points[1]))
            {
                return;
            }
            InitSession();
            var sketchCreator = new SketchCreator(Document);
            var normalOnPlane = sketchCreator.NormalOnSketch.Value.GpAxis;

            var builder = NodeBuilderUtils.BuildLineInDocument(Document, false, normalOnPlane, Points[0], Points[1]);

            NodeBuilderUtils.BuildDimensionForLine(Document, builder, Points[0], Points[1]);
            UpdateView();
        }