/***************************************************/ 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()); }
/***************************************************/ /**** 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); }
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()); }
/***************************************************/ /**** Interface Methods ****/ /***************************************************/ public static List <Curve> IToRevitCurves(this BH.oM.Geometry.ICurve curve) { return(ToRevitCurves(curve as dynamic)); }