示例#1
0
        private void DefineAdvancedWallFields()
        {
            // get location curve
            if (!(Wall.Location is LocationCurve locationCurve))
            {
                IsDefined = false;
                return;
            }

            // Get curve from location curve
            LocationCurveCurve = locationCurve.Curve;

            // get curve type
            switch (locationCurve.Curve)
            {
            case Line _:
                CurveType = ElementCurveType.Line;
                break;

            case Arc _:
                CurveType = ElementCurveType.Arc;
                break;

            default:
                IsDefined = false;
                return;
            }

            // get ends points
            StartPoint = locationCurve.Curve.GetEndPoint(0);
            EndPoint   = locationCurve.Curve.GetEndPoint(1);
            MidPoint   = 0.5 * (StartPoint + EndPoint);

            // get solids
            GetSolids();

            // get faces and edges
            GetFacesAndEdges();

            if (Edges.Count == 0 || AdvancedPlanarFaces.Count == 0)
            {
                IsDefined = false;
                return;
            }

            // get orientation
            Orientation = GeometryHelpers.GetElementOrientation(locationCurve.Curve);
            if (Orientation == ElementOrientation.CloseToHorizontal ||
                Orientation == ElementOrientation.CloseToVertical ||
                Orientation == ElementOrientation.Undefined)
            {
                IsDefined = false;
            }
        }
        private void DefineAdvancedGridFields()
        {
            // get location curve
            var curve = _grid.Curve;

            if (curve == null)
            {
                IsDefined = false;
                return;
            }

            switch (curve)
            {
            // get curve type
            case Line _:
                CurveType = ElementCurveType.Line;
                break;

            case Arc _:
                CurveType = ElementCurveType.Arc;
                break;

            default:
                IsDefined = false;
                return;
            }

            // points
            StartPoint = curve.GetEndPoint(0);
            EndPoint   = curve.GetEndPoint(1);

            // get orientation
            Orientation = GeometryHelpers.GetElementOrientation(curve);
            if (Orientation == ElementOrientation.CloseToHorizontal ||
                Orientation == ElementOrientation.CloseToVertical ||
                Orientation == ElementOrientation.Undefined)
            {
                IsDefined = false;
            }
        }