コード例 #1
0
        public ExternalExtrusionToolpath(IList <Polyline> polylines, ExtrusionAttributes attributes, double extrusionFactor, double suckBack, double startDistance, double loopDistance)
        {
            _att             = attributes;
            _extrusionFactor = extrusionFactor;
            _suckBack        = -suckBack;
            _startDistance   = startDistance;
            _loopDistance    = loopDistance;

            var robotPosition = Point3d.Origin;

            robotPosition.Transform(Transform.PlaneToPlane(_att.Frame.Plane, Plane.WorldXY));

            var paths = polylines.Select(p => ToTargets(p, robotPosition)).ToList();

            CreateTargets(paths);
        }
コード例 #2
0
        public ExternalExtrusionToolpath(List <List <Plane> > locations, List <List <double> > lengths, ExtrusionAttributes attributes, double extrusionFactor, double suckBack, double startDistance, double loopDistance)
        {
            _att             = attributes;
            _extrusionFactor = extrusionFactor;
            _suckBack        = -suckBack;
            _startDistance   = startDistance;
            _loopDistance    = loopDistance;

            var paths = new List <List <SimpleTarget> >(locations.Count);

            if (locations.Count != lengths.Count)
            {
                throw new ArgumentException("Number of paths in locations and lengths don't match.");
            }

            if (locations.Count == 0)
            {
                throw new ArgumentException("There should be more than one path.");
            }

            for (int i = 0; i < locations.Count; i++)
            {
                if (locations[i].Count != lengths[i].Count)
                {
                    throw new ArgumentException($"Locations and lengths in path {i} don't match.");
                }

                int pathCount = locations[0].Count;

                var path = new List <SimpleTarget>(pathCount);

                for (int j = 0; j < locations[0].Count; j++)
                {
                    path.Add(new SimpleTarget()
                    {
                        Location = locations[i][j], Length = lengths[i][j]
                    });
                }

                paths.Add(path);
            }

            CreateTargets(paths);
        }