private Point3dCollection InitializeLdsMesh()
        {
            var list        = new Point3dCollection();
            var ld          = _properties.Parts.SelectedLd;
            var lp          = _properties.Parts.SelectedLp;
            var cast        = _properties.Parts.SelectedCast;
            var spacing     = _properties.Algorythim.Options.DistanceBetweenLpAndLd;
            var startVector = new Vector3d(0, lp.Height + spacing, 0);
            var startPoint  = _properties.StartPoint.Add(startVector);
            var incrVector  = new Vector2d(cast.Width, ld.Width + spacing * 2.0 + lp.Height);

            for (double y = startPoint.Y; y < _properties.MaxPoint.Y; y += incrVector.Y)
            {
                list.Add(new Point3d(startPoint.X, y, 0));
                double x = 0;
                for (x = startPoint.X; x < _properties.MaxPoint.X && SlabAlgorythim.IsInsidePolygon(_outline, new Point3d(x + incrVector.X + 10, y, 0)); x += incrVector.X)
                {
                    ;
                }

                if (SlabAlgorythim.IsInsidePolygon(_outline, new Point3d(x + _properties.Algorythim.Options.OutlineDistance / 2.0 + cast.Width, y, 0)))
                {
                    list.Add(new Point3d(x, y, 0));
                }
                else
                {
                    list.Add(new Point3d(x, y, 0));
                }
            }

            return(list);
        }
Esempio n. 2
0
        protected bool CanPlacePart(Point3d loc, Part part, float orientationAngle, ObjectId outlinePartId)
        {
            var isInside = SlabAlgorythim.IsInsidePolygon(_environment.Outline, loc);

            if (!isInside)
            {
                return(false);
            }

            //if (part.UsageType == UsageType.Head) return true;

            using (var t = _acad.StartTransaction())
            {
                var partOutlineRefId = PlacePart(part, loc, orientationAngle, outlinePartId);
                var partOutlineRef   = t.GetObject(partOutlineRefId, OpenMode.ForRead) as BlockReference;

                var intersections = new Point3dCollection();
                _environment.Outline.IntersectWith(partOutlineRef, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                if (intersections.Count > 0)
                {
                    return(false);
                }

                foreach (var e in _environment.Girders)
                {
                    partOutlineRef.IntersectWith(e, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                    if (intersections.Count > 0)
                    {
                        return(false);
                    }
                }

                foreach (var e in _environment.Collumns)
                {
                    partOutlineRef.IntersectWith(e, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                    if (intersections.Count > 0)
                    {
                        return(false);
                    }
                }

                foreach (var e in _environment.Empties)
                {
                    partOutlineRef.IntersectWith(e, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
                    if (intersections.Count > 0)
                    {
                        return(false);
                    }

                    if (SlabAlgorythim.IsInsidePolygon(e, loc))
                    {
                        return(false);
                    }
                }

                partOutlineRef?.Erase();
                t.Commit();
            }

            return(true);
        }