public static LoadModel Create(string name, LoadType loadType, double poundsPerSquareFoot)
        {
            LoadModel _loadModel = new LoadModel
            {
                Name     = name,
                LoadType = loadType,
                PoundsForcePerSquareFoot = poundsPerSquareFoot,
            };

            return(_loadModel);
        }
Esempio n. 2
0
        private List <LoadModel> createLoadModels(Element element, LoadType loadType)
        {
            List <LoadModel> _squareLoadModels = new List <LoadModel>();

            //maximum parking ramp slope = 6.67%
            //https://www.rochestermn.gov/home/showdocument?id=18472#:~:text=Parking%20ramp%20slopes%20should%20not,International%20Building%20Code%20(IBC).
            List <Solid>      _solids   = GeometryHelpers.GetGeometryObjects(element, ViewDetailLevel.Fine).OfType <Solid>().ToList();
            List <PlanarFace> _topFaces = _solids.SelectMany(p => p.Faces.OfType <PlanarFace>()).Where(p =>
                                                                                                       p.FaceNormal.Z > 0.0 &&
                                                                                                       (p.FaceNormal.Z / Math.Sqrt(Math.Pow(p.FaceNormal.X, 2.0) + Math.Pow(p.FaceNormal.Y, 2.0))) > 0.0667).ToList();

            //Populate  FloorProfileModel for our FloorModel
            Plane      _levelPlane = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ(0, 0, Level.Elevation));
            PlanarFace _topFace    = _topFaces.OrderBy(p => p.Origin.DistanceTo(_levelPlane.ProjectOnto(p.Origin))).FirstOrDefault();

            if (_topFace == null)
            {
                return(_squareLoadModels);
            }

            foreach (EdgeArray _edgeArray in _topFace.EdgeLoops.OfType <EdgeArray>())
            {
                List <Curve> _curves = _edgeArray.OfType <Edge>().Select(p => p.AsCurve()).ToList();

                //Project curves onto a flat plane with Normal = XYZ.BasizZ
                List <Curve> _projectedCurves = new List <Curve>();
                foreach (Curve _curve in _curves)
                {
                    XYZ _projectedEnd0 = _levelPlane.ProjectOnto(_curve.GetEndPoint(0));
                    XYZ _projectedEnd1 = _levelPlane.ProjectOnto(_curve.GetEndPoint(1));

                    if (_projectedEnd0.DistanceTo(_projectedEnd1) <= 1E-09)
                    {
                        continue;
                    }

                    if (_curve is Line _line)
                    {
                        Line _projectedLine = Line.CreateBound(_projectedEnd0, _projectedEnd1);
                        _projectedCurves.Add(_projectedLine);
                    }
                    else if (_curve is Arc _arc)
                    {
                        XYZ _projectedPointOnArc = _levelPlane.ProjectOnto(_arc.Evaluate(0.5, true));
                        Arc _projectedArc        = Arc.Create(_projectedEnd0, _projectedEnd1, _projectedPointOnArc);
                        _projectedCurves.Add(_projectedArc);
                    }
                }

                bool _sorted = SortCurvesContiguous(_projectedCurves);

                LoadModel _loadModel = LoadModel.Create();
                _loadModel.LoadType   = loadType;
                _loadModel.PlanarFace = _topFace;
                _loadModel.Curves     = _projectedCurves;
                _loadModel.Element    = element;

                _squareLoadModels.Add(_loadModel);
            }

            return(_squareLoadModels);
        }
        public static LoadModel Create()
        {
            LoadModel _loadModel = new LoadModel();

            return(_loadModel);
        }