Esempio n. 1
0
        private void BuildEndLp(Dictionary <Point3d, Point3dCollection> scanlines)
        {
            var orientationAngle = _properties.Parts.SelectedLp.GetOrientationAngle(_properties.Algorythim.GlobalOrientationAngle);

            foreach (var scanline in scanlines)
            {
                var  p = scanline.Value[2];
                var  dist = scanline.Value[0].DistanceTo(scanline.Value[2]);
                Part firstLp, secondLp;
                FindBetterLpCombination(_properties, dist, out firstLp, out secondLp);

                if (firstLp != null)
                {
                    var firtLpOutline = GetOrCreatePartOutline(firstLp);
                    if (CanPlacePart(p, firstLp, orientationAngle, firtLpOutline))
                    {
                        PlacePart(firstLp, p, orientationAngle, GetOrCreatePart(firstLp));
                    }
                    if (secondLp != null)
                    {
                        var lpDirection     = SlabAlgorythim.VectorFrom(orientationAngle);
                        var nextPoint       = p.Add(lpDirection * (firstLp.Width + _properties.Algorythim.Options.DistanceBetweenLp));
                        var secondLpOutline = GetOrCreatePartOutline(secondLp);
                        if (CanPlacePart(nextPoint, secondLp, orientationAngle, secondLpOutline))
                        {
                            PlacePart(firstLp, nextPoint, orientationAngle, GetOrCreatePart(secondLp));
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void BuildAlternativeZoneStartLp(Point3dCollection points, double orientationAngle, ObjectIdCollection placedObjects)
        {
            var alternativePoints = new Point3dCollection();
            var direction         = SlabAlgorythim.VectorFrom(orientationAngle);
            var lastPart          = _properties.Algorythim.SelectedStartLp;
            var part = _partRepository.GetNextSmaller(lastPart, lastPart.UsageType);

            do
            {
                foreach (Point3d point in points)
                {
                    var desloc = direction * (lastPart.Width - part.Width);
                    alternativePoints.Add(point.Add(desloc));
                }

                points = PlaceMultipleParts(points, part, placedObjects);
            } while (points.Count > 0 && (part = _partRepository.GetNextSmaller(part, lastPart.UsageType)) != null);
        }
Esempio n. 3
0
        protected Point3d?LineCast(Point3d startPoint, double angle, double distance)
        {
            var intersections = new Point3dCollection();
            var direction     = SlabAlgorythim.VectorFrom(angle);

            using (var line = new Line(startPoint, startPoint.Add(direction * distance)))
            {
                _environment.Outline.IntersectWith(line, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);

                foreach (var o in _environment.Girders)
                {
                    line.IntersectWith(o, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                }

                foreach (var o in _environment.Collumns)
                {
                    line.IntersectWith(o, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                }

                foreach (var o in _environment.Empties)
                {
                    line.IntersectWith(o, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                }
            }

            var     smallestDistance = double.MaxValue;
            Point3d?nearestPoint     = null;

            foreach (Point3d p in intersections)
            {
                var dist = startPoint.DistanceTo(p);
                if (dist < smallestDistance)
                {
                    smallestDistance = dist;
                    nearestPoint     = p;
                }
            }

            return(nearestPoint);
        }
Esempio n. 4
0
        public void BuildAlternativeLd(Point3dCollection points, Part lastPart)
        {
            if (points.Count == 0)
            {
                return;
            }
            var part      = lastPart;
            var direction = SlabAlgorythim.VectorFrom(90 - _properties.Algorythim.GlobalOrientationAngle);
            var nextPart  = _partRepository.GetNextSmaller(part, lastPart.UsageType);

            for (int i = 0; i < points.Count; i++)
            {
                points[i] = points[i].Add(direction * (lastPart.Width - part.Width));
            }

            points = PlaceMultipleParts(points, part);

            if (points.Count > 0 && nextPart != null)
            {
                BuildAlternativeLd(points, nextPart);
            }
        }