コード例 #1
0
        /***************************************************/

        public static double OrientationAngleColumn(this FamilyInstance familyInstance, RevitSettings settings)
        {
            double   rotation = double.NaN;
            Location location = familyInstance.Location;

            if (location is LocationPoint)
            {
                rotation = Math.PI * 0.5 + (location as LocationPoint).Rotation;
            }
            else if (location is LocationCurve)
            {
                BH.oM.Geometry.ICurve locationCurve = (location as LocationCurve).Curve.IFromRevit();
                Transform             transform     = familyInstance.GetTotalTransform();
                if ((locationCurve as BH.oM.Geometry.Line).IsVertical())
                {
                    rotation = XYZ.BasisY.AngleOnPlaneTo(transform.BasisX, transform.BasisZ);
                }
                else
                {
                    rotation = XYZ.BasisZ.AngleOnPlaneTo(transform.BasisY, transform.BasisZ);
                }
            }

            return(rotation.NormalizeAngleDomain());
        }
コード例 #2
0
        /***************************************************/
        /****              Public methods               ****/
        /***************************************************/

        public static CurveLoop ToRevitCurveLoop(this BH.oM.Geometry.ICurve curve)
        {
            CurveLoop curveLoop = new CurveLoop();

            foreach (Curve revitCurve in curve.IToRevitCurves())
            {
                curveLoop.Append(revitCurve);
            }

            return(curveLoop);
        }
コード例 #3
0
        public static double OrientationAngle(this MEPCurve mepCurve, RevitSettings settings = null)
        {
            settings = settings.DefaultIfNull();

            double rotation;

            Location location = mepCurve.Location;

            LocationCurve locationCurve = location as LocationCurve;
            Curve         curve         = locationCurve.Curve;

            BH.oM.Geometry.ICurve bhomCurve = curve.IFromRevit(); // Convert to a BHoM curve

            // Get the connector
            Connector connector = null;

            foreach (Connector conn in mepCurve.ConnectorManager.Connectors)
            {
                // Get the End connector for this duct
                if (conn.ConnectorType == ConnectorType.End)
                {
                    connector = conn;
                    break;
                }
            }

            // Coordinate system of the connector
            Transform transform = connector.CoordinateSystem;

            // Get the rotation
            if ((bhomCurve as BH.oM.Geometry.Line).IsVertical()) // Is the duct vertical?
            {
                rotation = XYZ.BasisY.AngleOnPlaneTo(transform.BasisX, transform.BasisZ);
            }
            else
            {
                rotation = Math.PI + XYZ.BasisZ.AngleOnPlaneTo(transform.BasisY, transform.BasisZ);
            }

            return(rotation.NormalizeAngleDomain());
        }
コード例 #4
0
ファイル: CurveList.cs プロジェクト: chuongmep/Revit_Toolkit
        /***************************************************/
        /****             Interface Methods             ****/
        /***************************************************/

        public static List <Curve> IToRevitCurves(this BH.oM.Geometry.ICurve curve)
        {
            return(ToRevitCurves(curve as dynamic));
        }