void ExecuteSwitchMode(Imprint.ImprintMode mode)
 {
     if (Imprint.Mode != mode)
     {
         Imprint.Mode = mode;
         CommmitChange();
     }
 }
        //--------------------------------------------------------------------------------------------------

        /// <summary>
        /// Create a new imprint by selecting a target face.
        /// </summary>
        public CreateImprintTool(Body targetBody, Imprint.ImprintMode initialMode = Imprint.ImprintMode.Default)
        {
            _TargetBody  = targetBody;
            _TargetShape = _TargetBody?.Shape;
            Debug.Assert(_TargetShape != null);

            _ImprintMode = initialMode;
            if (_ImprintMode == Imprint.ImprintMode.Default)
            {
                _ImprintMode = Imprint.ImprintMode.Raise;
            }

            _Mode = ToolMode.CreateNew;
        }
Example #3
0
        public void ChamferFaces(int edgeToChamfer, int faceToImprint, Imprint.ImprintMode mode)
        {
            var body    = TestGeomGenerator.CreateBox().Body;
            var chamfer = Chamfer.Create(body, new[] { body.Shape.GetSubshapeReference(SubshapeType.Edge, edgeToChamfer) });

            chamfer.Distance = 5.0;
            var imprint = Imprint.Create(body, body.Shape.GetSubshapeReference(SubshapeType.Face, faceToImprint));
            var center  = imprint.Sketch.AddPoint(new Pnt2d(0, 0));
            var rim     = imprint.Sketch.AddPoint(new Pnt2d(0, 2));

            imprint.Sketch.AddSegment(new SketchSegmentCircle(center, rim));
            imprint.Mode = mode;

            Assert.IsTrue(imprint.Make(Shape.MakeFlags.None));
            Assert.IsTrue(ModelCompare.CompareShape(body.Shape, Path.Combine(_BasePath, $"ChamferFaces_{edgeToChamfer}_{mode}")));
        }