示例#1
0
 private void AddEntity(IPathEntity pe)
 {
     if (toolpath.Count > 0)
     {
         pe.PrevPosition = new CNCLib.MachinePosition(toolpath.Last().Position);
     }
     else
     {
         pe.PrevPosition = new CNCLib.MachinePosition(pe.Position);
     }
     toolpath.Add(pe);
 }
示例#2
0
        public ToolPath ParsePath(List <string> file)
        {
            jeton = false;
            int pathNumber = 0;

            foreach (string line in file)
            {
                BlockType blockT;

                if (!jeton)
                {
                    jeton = IsPathStart(line);
                }
                else
                {
                    jeton = !IsPathEnd(line);
                }

                if (IsPath(line, out blockT))
                {
                    IPathEntity pe = parseString(line, blockT, jeton);


                    path.Add(pe);
                    pathNumber++;
                }
            }
            for (int i = 1; i < path.Count; i++)
            {
                if (path[i].JetOn && !path[i - 1].JetOn)
                {
                    path[i - 1].JetOn          = true;
                    path[i - 1].Feedrate.Value = path[i].Feedrate.Value;
                }
            }
            //calc arc sweep angle and travel time for each segment


            CalcPathLengths();
            FillMissingCoords();
            return(path);
        }