Example #1
0
 public void InsertAll(AbmachSurface surface)
 {
     for (int i = 0; i < xSize; i++)
     {
         int xIndex = surface.Xindex(Xposition(i));
         for (int j = 0; j < ySize; j++)
         {
             int yIndex = surface.Yindex(Yposition(j));
             values[i, j] = surface.GetValue(xIndex, yIndex);
         }
     }
 }
Example #2
0
        public void Insert(AbmachValType type, AbmachSurface surface)
        {
            for (int i = 0; i < xSize; i++)
            {
                int xIndex = surface.Xindex(Xposition(i));
                for (int j = 0; j < ySize; j++)
                {
                    int       yIndex = surface.Yindex(Yposition(j));
                    AbmachVal v      = surface.GetValue(xIndex, yIndex);

                    SetValue(type, v, xIndex, yIndex);
                }
            }
        }
Example #3
0
        public void SubtractSurface2D(CancellationToken ct, IProgress <int> progress)
        {
            int jetR = abmachParams.AbMachJet.JetRadius;

            matRemRate = abmachParams.RemovalRate;
            int prevXIndex = surf.Xindex(path.Entities[0].Position.X);
            int prevYIndex = surf.Xindex(path.Entities[0].Position.Y);

            for (int iteration = 0; iteration < runInfo.Iterations; iteration++)// iterations
            {
                runInfo.CurrentIteration += 1;
                for (int run = 0; run < runInfo.Runs; run++)//runs
                {
                    runInfo.CurrentRun += 1;
                    foreach (ModelPathEntity ent in path.Entities)//path
                    {
                        int    xIndex     = surf.Xindex(ent.Position.X);
                        int    yIndex     = surf.Yindex(ent.Position.Y);
                        double deltaIndex = Math.Sqrt(Math.Pow(xIndex - prevXIndex, 2) + Math.Pow(yIndex - prevYIndex, 2));
                        prevXIndex = xIndex;
                        prevYIndex = yIndex;
                        if (deltaIndex != 0)
                        {
                            double feedFactor = feedrateFactor(ent.Feedrate, deltaIndex, matRemRate);
                            //subtract jet footprint and put into temp surface
                            //temp surface so that slope calc is not affected by depth changes
                            for (int a = xIndex - jetR; a <= xIndex + jetR; a++)
                            {
                                for (int b = yIndex - jetR; b <= yIndex + jetR; b++)
                                {
                                    double depth = feedFactor * slopeFactor(surf.Normal(a, b)) * surf.GetValue(a, b).MachIndex *abmachParams.AbMachJet.FootPrint(a - xIndex + jetR, b - yIndex + jetR);
                                    surf.SetValue(AbmachValType.Temp, depth, a, b);
                                }
                            }
                            //smooth surface and place in temp surface smooth spikes and pits
                            for (int a = xIndex - jetR; a <= xIndex + jetR; a++)
                            {
                                for (int b = yIndex - jetR; b <= yIndex + jetR; b++)
                                {
                                    smoothValue(a, b);
                                }
                            }
                            //replace model surface with smoothed surface
                            for (int a = xIndex - jetR; a <= xIndex + jetR; a++)
                            {
                                for (int b = yIndex - jetR; b <= yIndex + jetR; b++)
                                {
                                    surf.SetValue(AbmachValType.Model, surf.GetValue(a, b).Temp, a, b);
                                }
                            }
                        }
                    }//next toolpath segment
                    //get depth at depth location
                    abmachParams.DepthInfo.DepthAtLocation = getDepth(abmachParams.DepthInfo.LocationOfDepthMeasure);
                    //adjust material removal rate if requested
                    if (abmachParams.RunInfo.RunType == ModelRunType.NewMRR)
                    {
                        abmachParams.RemovalRate = adjustMRR(abmachParams.DepthInfo.DepthAtLocation, matRemRate, runInfo);
                    }
                }//next run
                if (abmachParams.RunInfo.RunType == ModelRunType.NewFeedrates)
                {
                    adjustFeedRates();
                }
            }//next iteration
        }