double getMinDepth(ModelPathEntity mpe, double searchRadius)
        {
            List <AbmachPoint> jetIntersectList = surface.GetPointsInsideBox(BoundingBoxBuilder.GetSearchBox(mpe.PositionAsVector3, searchRadius));
            double             minDepth         = 1e16;

            foreach (AbmachPoint pt in jetIntersectList)
            {
                double depth = getPointDepth(pt);
                if (depth < minDepth)
                {
                    minDepth = depth;
                }
            }
            return(minDepth);
        }
        double getDepth(ModelPathEntity mpe, DepthInfo depthInfo)
        {
            switch (depthInfo.SearchType)
            {
            case DepthSearchType.FindMaxDepth:
                return(getMaxDepth(mpe, depthInfo.SearchRadius));

            case DepthSearchType.FindMinDepth:
                return(getMinDepth(mpe, depthInfo.SearchRadius));

            case DepthSearchType.FindAveDepth:
            default:
                return(getAveDepth(mpe, depthInfo.SearchRadius));
            }
        }
Exemple #3
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);
        }
        double getAveDepth(ModelPathEntity mpe, double searchRadius)
        {
            double depth = 0;

            List <AbmachPoint> jetIntersectList = surface.GetPointsInsideBox(BoundingBoxBuilder.GetSearchBox(mpe.PositionAsVector3, searchRadius));
            int pointCount = 0;

            foreach (AbmachPoint pt in jetIntersectList)
            {
                if (pt.JetHit)
                {
                    depth += getPointDepth(pt);
                    pointCount++;
                }
            }

            depth = pointCount > 0 ? depth / pointCount : 0;

            return(depth);
        }
        private RemovalRate newRemovalRate(ModelPath path, RunInfo runInfo, RemovalRate oldRemovalRate, DepthInfo depthInfo)
        {
            var             newRemovalRate           = new RemovalRate();
            ModelPathEntity mpeDepth                 = nearestPathEntity(path, depthInfo.LocationOfDepthMeasure);
            double          currentDepth             = getDepth(mpeDepth, depthInfo);
            double          currentDepthPerRun       = currentDepth / runInfo.CurrentRun;
            double          currentTargetDepthPerRun = depthInfo.TargetDepth / runInfo.CurrentRun;

            depthInfo.CurrentDepth = currentDepth;

            if (currentDepth != 0)
            {
                double newMrr = oldRemovalRate.DepthPerPass * (currentTargetDepthPerRun / currentDepthPerRun);
                return(newRemovalRate);
            }
            else
            {
                return(oldRemovalRate);
            }
        }
Exemple #7
0
        /// <summary>
        /// calc change in jet surface speed due to B axis move
        /// </summary>
        /// <param name="depth"></param>
        /// <param name="ent"></param>
        /// <returns></returns>
        double deltaBAxisFactor(double depth, ModelPathEntity ent)
        {
            //TODO calc deltab

            return(1);
        }