Пример #1
0
        public FaceToolPath(Face face, CuttingTool tool, CuttingParameters parameters, StrategyType strategy)
            : base(tool, parameters)
        {
            Debug.Assert(tool != null);
            Debug.Assert(parameters != null);

            Face     = face;
            Strategy = strategy;
        }
Пример #2
0
        protected ToolPath(CuttingTool tool, CuttingParameters parameters)
        {
            Debug.Assert(tool != null);
            Debug.Assert(parameters != null);

            CuttingTool       = tool;
            CuttingParameters = parameters;
            Csys = Frame.World;
        }
Пример #3
0
        protected override void OnInitialize()
        {
            Rendering      = null;
            SelectionTypes = new[] { typeof(DesignFace), typeof(CustomObject) };
            StatusText     = Resources.FaceToolPathToolStatusText;

            var tool       = BallMill.StandardSizes.Values.ToArray()[4];
            var parameters = new CuttingParameters(tool.Radius, 10, tool.Radius * 2);

            FaceToolPathObject.DefaultToolPath = new FaceToolPath(null, tool, parameters, FaceToolPath.StrategyType.UV);
            FaceToolPathObject.DefaultColor    = ToolPathColorProperty.ColorList[0];
            FaceToolPathObject.DefaultStrategy = 0;
        }
Пример #4
0
        public SpiralStrategy(Plane plane, ICollection <ITrimmedCurve> curves, double initialOffset, ToolPath toolPath)
        {
            this.plane         = plane;
            this.curves        = curves;
            this.toolPath      = toolPath;
            this.tool          = toolPath.CuttingTool;
            this.parameters    = toolPath.CuttingParameters;
            this.initialOffset = initialOffset;

            SurfaceEvaluation eval = plane.Evaluate(PointUV.Origin);

            centerOffset         = eval.Normal * tool.Radius;
            tip                  = -toolPath.Csys.DirZ * tool.Radius;
            closeClearanceVector = toolPath.Csys.DirZ * tool.Radius;
        }
Пример #5
0
        public SpiralFacingToolPath(Face face, ICollection <Face> sideFaces, CuttingTool tool, CuttingParameters parameters)
            : base(face, tool, parameters)
        {
            Debug.Assert(sideFaces.Where(f => f.Body == face.Body).Count() == sideFaces.Count, "All faces must belong to same body.");

            bool isReversed = Vector.Dot(face.Geometry.Evaluate(PointUV.Origin).Normal.UnitVector, Csys.DirZ.UnitVector) < 0 ^ face.IsReversed;

            Body bodyCopy = face.Body.CopyFaces(sideFaces.Concat(new[] { face }).ToArray());

            bodyCopy.OffsetFaces(null, CuttingTool.Radius * (isReversed ? -1 : 1));
            Face offsetFace = bodyCopy.Faces.Where(f => f.Edges.Where(e => e.Faces.Count == 1).Count() == 0).First();

            plane = face.Geometry as Plane;
            if (plane == null)
            {
                throw new NotImplementedException();
            }

            Debug.Assert(face.Loops.Where(l => l.IsOuter).Count() == 1);

            curves        = offsetFace.Loops.Where(l => l.IsOuter).First().Edges.Select(e => e.ProjectToPlane(plane)).ToArray();
            initialOffset = 0;
        }