Пример #1
0
 public TPVertexData(TPVertexData other)
 {
     Flags              = other.Flags;
     PositionF          = other.PositionF;
     FeedRateModifierF  = other.FeedRateModifierF;
     ExtrusionModifierF = other.ExtrusionModifierF;
 }
Пример #2
0
        public virtual Vector3d AppendExtrude(List <Vector2d> toPoints,
                                              double fSpeed, Vector2d dimensions,
                                              FillTypeFlags pathTypeFlags         = FillTypeFlags.Unknown,
                                              List <TPVertexFlags> perVertexFlags = null)
        {
            Vector2d useDims = currentDims;

            if (dimensions.x > 0 && dimensions.x != NO_DIM.x)
            {
                useDims.x = dimensions.x;
            }
            if (dimensions.y > 0 && dimensions.y != NO_DIM.y)
            {
                useDims.y = dimensions.y;
            }

            LinearToolpath extrusion = new LinearToolpath(ToolpathTypes.Deposition);

            extrusion.TypeModifiers = pathTypeFlags;
            extrusion.AppendVertex(new PrintVertex(currentPos, NO_RATE, useDims), TPVertexFlags.IsPathStart);

            for (int k = 0; k < toPoints.Count; ++k)
            {
                Vector3d      pos  = new Vector3d(toPoints[k].x, toPoints[k].y, currentPos.z);
                TPVertexFlags flag = (k == toPoints.Count - 1) ? TPVertexFlags.IsPathEnd : TPVertexFlags.None;
                extrusion.AppendVertex(new PrintVertex(pos, fSpeed, useDims), flag);
            }
            if (perVertexFlags != null)
            {
                ToolpathUtil.AddPerVertexFlags(extrusion, perVertexFlags);
            }
            AppendPath(extrusion);
            return(currentPos);
        }
Пример #3
0
        public void AppendVertex(T v, TPVertexFlags flags)
        {
            if (Path.Count == 0 || ((flags & TPVertexFlags.IsPathStart) != 0))
            {
                Path.Add(v);
                return;
            }
            bool is_end = ((flags & TPVertexFlags.IsPathEnd) != 0);

            if (is_end && Path.Count == 1)
            {
                Path.Add(v);
                return;
            }

            double distSqr = End.Position.DistanceSquared(v.Position);

            if (distSqr < MathUtil.Epsilonf)
            {
                if (is_end)
                {
                    Path[Path.Count - 1] = v;
                }
                // otherwise just discard
            }
            else
            {
                Path.Add(v);
            }

            //if ( Path.Count == 0 || End.Position.DistanceSquared(v.Position) > MathUtil.Epsilon )
            //	Path.Add(v);
        }
Пример #4
0
 public void AppendVertex(Vector2d v, TPVertexFlags flag)
 {
     alloc_flags();
     base.AppendVertex(v);
     flags.Add(flag);
     has_flags = true;
 }
Пример #5
0
        public virtual LinearToolpath CreateExtrude(
            List <Vector2d> toPoints,
            double fSpeed, Vector2d dimensions,
            IFillType fillType,
            bool isHole,
            List <TPVertexFlags> perVertexFlags = null)
        {
            Vector2d useDims = currentDims;

            if (dimensions.x > 0 && dimensions.x != NO_DIM.x)
            {
                useDims.x = dimensions.x;
            }
            if (dimensions.y > 0 && dimensions.y != NO_DIM.y)
            {
                useDims.y = dimensions.y;
            }

            LinearToolpath extrusion = new LinearToolpath(MoveType);

            extrusion.FillType = fillType;
            extrusion.AppendVertex(new PrintVertex(currentPos, NO_RATE, useDims), TPVertexFlags.IsPathStart);

            for (int k = 1; k < toPoints.Count; ++k)
            {
                Vector3d      pos  = new Vector3d(toPoints[k].x, toPoints[k].y, currentPos.z);
                TPVertexFlags flag = (k == toPoints.Count - 1) ? TPVertexFlags.IsPathEnd : TPVertexFlags.None;
                extrusion.AppendVertex(new PrintVertex(pos, fSpeed, useDims), flag);
            }
            if (perVertexFlags != null)
            {
                ToolpathUtil.AddPerVertexFlags(extrusion, perVertexFlags);
            }
            return(extrusion);
        }
Пример #6
0
        public virtual Vector3d AppendTravel(List <Vector3d> toPoints, double fSpeed)
        {
            LinearToolpath travel = new LinearToolpath(ToolpathTypes.Travel);

            travel.AppendVertex(new PrintVertex(currentPos, NO_RATE, NO_DIM), TPVertexFlags.IsPathStart);
            for (int k = 0; k < toPoints.Count; ++k)
            {
                Vector3d      pos  = toPoints[k];
                TPVertexFlags flag = (k == toPoints.Count - 1) ? TPVertexFlags.IsPathEnd : TPVertexFlags.None;
                travel.AppendVertex(new PrintVertex(pos, fSpeed, NO_DIM), flag);
            }
            if (travel.Length > MathUtil.Epsilonf)
            {
                AppendPath(travel);
            }
            return(currentPos);
        }
Пример #7
0
        public virtual Vector3d AppendExtrude(List <Vector3d> toPoints, double fSpeed,
                                              IFillType fillType, List <TPVertexFlags> perVertexFlags = null)
        {
            LinearToolpath extrusion = new LinearToolpath(MoveType);

            extrusion.FillType = fillType;
            extrusion.AppendVertex(new PrintVertex(currentPos, NO_RATE, currentDims), TPVertexFlags.IsPathStart);
            for (int k = 0; k < toPoints.Count; ++k)
            {
                TPVertexFlags flag = (k == toPoints.Count - 1) ? TPVertexFlags.IsPathEnd : TPVertexFlags.None;
                extrusion.AppendVertex(new PrintVertex(toPoints[k], fSpeed, currentDims), flag);
            }
            if (perVertexFlags != null)
            {
                ToolpathUtil.AddPerVertexFlags(extrusion, perVertexFlags);
            }
            AppendPath(extrusion);
            return(currentPos);
        }
Пример #8
0
 public void AppendVertex(T v, TPVertexFlags flags)
 {
     Path.Add(v);
 }
Пример #9
0
 public void SetFlag(int i, TPVertexFlags flag)
 {
     alloc_flags(); flags[i] = flag;
 }