public static HLBoundingBoxXYZ FromXYZPoints(IList <XYZ> points)
        {
            HLBoundingBoxXYZ bbox = new HLBoundingBoxXYZ();

            foreach (XYZ point in points)
            {
                bbox.ExpandToContain(point);
            }

            return(bbox);
        }
        public SolidGeometrySegment(Solid geo, Element element, HLBoundingBoxXYZ bounds)
        {
            Geometry            = geo;
            OriginatingElement  = element.Id;
            OriginatingDocIdent = DocUtils.GetDocumentIdent(element.Document);
            if (element.Category != null)
            {
                OriginatingElementCategory = element.Category.Id;
            }

            Bounds = bounds;

            Removed = false;
            segId   = Guid.NewGuid().ToString();
        }
示例#3
0
        public CurveGeometrySegment(Curve curve, Element element)
        {
            Geometry = curve;

            OriginatingElement  = element.Id;
            OriginatingDocIdent = DocUtils.GetDocumentIdent(element.Document);
            if (element.Category != null)
            {
                OriginatingElementCategory = element.Category.Id;
            }

            var min = curve.GetEndPoint(0);
            var max = curve.GetEndPoint(1);

            MidPoint = (min + max) / 2;
            Bounds   = new HLBoundingBoxXYZ(min, max, false);
            Removed  = false;
            segId    = Guid.NewGuid().ToString();

            if (element is MEPCurve)
            {
                var dParam = element.get_Parameter(BuiltInParameter.RBS_CURVE_DIAMETER_PARAM);
                if (dParam != null)
                {
                    Radius = dParam.AsDouble() * 0.5;
                }
                else
                {
                    var wParam = element.get_Parameter(BuiltInParameter.RBS_CURVE_WIDTH_PARAM);
                    if (wParam != null)
                    {
                        Width = wParam.AsDouble();
                    }
                    var hParam = element.get_Parameter(BuiltInParameter.RBS_CURVE_HEIGHT_PARAM);
                    if (hParam != null)
                    {
                        Height = hParam.AsDouble();
                    }
                }
            }
        }
        public bool Intersects(HLBoundingBoxXYZ r2)
        {
            var r1 = this;

            return(r1.xmin <= r2.xmax && r1.xmax >= r2.xmin && r1.ymin <= r2.ymax && r1.ymax >= r2.ymin && r1.zmin <= r2.zmax && r1.zmax >= r2.zmin);
        }
        public bool Intersects(HLBoundingBoxXYZ r2)
        {
            var r1 = this;

            return(r1.Min.X <= r2.Max.X && r1.Max.X >= r2.Min.X && r1.Min.Y <= r2.Max.Y && r1.Max.Y >= r2.Min.Y && r1.Min.Z <= r2.Max.Z && r1.Max.Z >= r2.Min.Z);
        }