public void Sketch3DTo2DTest()
        {
            var axis     = new Axis(new Point3D(0, 0, 0), new Point3D(0, 0, 1));
            var result2D = Sketch3DTo2DTranslator.Translate(axis, new Point3D(10, 10, 10));

            Assert.IsTrue(result2D.IsEqual(new Point3D(10, 10, 0)), "invalid translated coordinate");
        }
 public void Setup(Sketch3DTo2DTranslator coordinateTranslator, SketchHinterOptions options,
                   ConstraintDocumentHelper constraintMapper, Hinter2D hinter2D)
 {
     Hinter2D             = hinter2D;
     CoordinateTranslator = coordinateTranslator;
     Options           = options;
     _constraintMapper = constraintMapper;
     constraintNodes   = new List <NodeBuilder>();
 }
Exemple #3
0
        public override void OnActivate()
        {
            base.OnActivate();
            var sketchBuilder = new SketchCreator(Document, false);
            var sketchNode    = sketchBuilder.CurrentSketch;

            if (sketchNode == null)
            {
                ActionsGraph.SwitchAction(ModifierNames.StartSketch, ModifierNames.FourLinesRectangle);
                return;
            }
            ActionsGraph[InputNames.CoordinateParser].Send(CoordinatateParserNames.SetStage, ParserStage.Unknown);
            sketchNode  = new SketchCreator(Document).CurrentSketch;
            _sketchNode = sketchNode;
            var nodeBuilder = new NodeBuilder(_sketchNode);

            _sketchCoordinateTranslator = new Sketch3DTo2DTranslator(nodeBuilder[0].Axis3D);
            Reset();
        }
Exemple #4
0
        private void InitializeFields()
        {
            _hinterShapeCreators = new SortedDictionary <string, HinterShapeCreatorBase>();
            HinterShapes         = new SortedDictionary <int, HinterShapeBase>();
            _algorithms          = new List <SketchHinterAlgorithmBase>();
            var nodeBuilder = new NodeBuilder(_sketchNode);

            _coordinateTranslator = new Sketch3DTo2DTranslator(nodeBuilder[0].Axis3D);

            _constraintMapper = new ConstraintDocumentHelper(_document, _sketchNode);

            Register(FunctionNames.LineTwoPoints, new LineHinterCreatorShape());
            Register(FunctionNames.Point, new PointHinterCreatorShape());
            Populate();

            AddAlgorithm <LineHorizontalAlgorithm>();
            AddAlgorithm <LineVerticalAlgorithm>();
            AddAlgorithm <LineParallelAlgorithm>();
            AddAlgorithm <LinePerpendicularAlgorithm>();
            AddAlgorithm <PointOnLineAlgorithm>();
        }