Esempio n. 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;
        }
Esempio n. 2
0
        protected ToolPath(CuttingTool tool, CuttingParameters parameters)
        {
            Debug.Assert(tool != null);
            Debug.Assert(parameters != null);

            CuttingTool       = tool;
            CuttingParameters = parameters;
            Csys = Frame.World;
        }
Esempio n. 3
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;
        }
Esempio n. 4
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;
        }