示例#1
0
 void buildPathFromEquation()
 {
     try
     {
         path = new ModelPath();
         for (int i = 0; i <= 100; i++)
         {
             double di  = i;
             var    pos = new XYZBCMachPosition();
             pos.X    = .1 + (di / 200);
             pos.Y    = .5;
             pos.Z    = 1;
             pos.Bdeg = 0;
             pos.Cdeg = 0;
             Vector3         jet   = new Vector3(0, 0, 1);
             ModelPathEntity mpEnt = new ModelPathEntity();
             mpEnt.Position       = pos;
             mpEnt.JetVector      = jet;
             mpEnt.JetOn          = true;
             mpEnt.Feedrate.Value = 10;
             mpEnt.TargetDepth    = .05;
             path.Add(mpEnt);
         }
         for (int i = 0; i <= 200; i++)
         {
             double di  = i;
             var    pos = new XYZBCMachPosition();
             pos.X    = .5;
             pos.Y    = .1 + (di / 200);
             pos.Z    = 1;
             pos.Bdeg = 0;
             pos.Cdeg = 0;
             Vector3         jet   = new Vector3(0, 0, 1);
             ModelPathEntity mpEnt = new ModelPathEntity();
             mpEnt.Position       = pos;
             mpEnt.JetVector      = jet;
             mpEnt.JetOn          = true;
             mpEnt.Feedrate.Value = 8;
             mpEnt.TargetDepth    = .05;
             path.Add(mpEnt);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        private ModelPath newFeedrates(ModelPath path, DepthInfo depthInfo)
        {
            ModelPath newPath = new ModelPath();

            foreach (ModelPathEntity mpe in path)
            {
                ModelPathEntity mpNew = mpe.Clone();
                mpe.Depth = getDepth(mpe, depthInfo);
                if (mpe.Depth != 0)
                {
                    mpNew.Feedrate.Value = mpe.Feedrate.Value * (mpe.Depth / mpe.TargetDepth);
                    mpNew.Depth          = mpe.Depth;
                }
                newPath.Add(mpNew);
            }
            savePath(path, "oldfeedrates");
            savePath(newPath, "newFeedrates");
            return(newPath);
        }