/***************************************************/ public static oM.Geometry.ICurve FromRevit(this Arc curve) { if (curve == null) { return(null); } if (!curve.IsBound) { return(new oM.Geometry.Circle { Centre = curve.Center.PointFromRevit(), Normal = curve.Normal.VectorFromRevit().Normalise(), Radius = curve.Radius.ToSI(UnitType.UT_Length) }); } BH.oM.Geometry.CoordinateSystem.Cartesian cs = BH.Engine.Geometry.Create.CartesianCoordinateSystem(curve.Center.PointFromRevit(), curve.XDirection.VectorFromRevit(), curve.YDirection.VectorFromRevit()); double startAngle = curve.XDirection.AngleOnPlaneTo(curve.GetEndPoint(0) - curve.Center, curve.Normal); double endAngle = curve.XDirection.AngleOnPlaneTo(curve.GetEndPoint(1) - curve.Center, curve.Normal); if (startAngle > endAngle) { startAngle -= 2 * Math.PI; } return(new oM.Geometry.Arc { CoordinateSystem = cs, Radius = curve.Radius.ToSI(UnitType.UT_Length), StartAngle = startAngle, EndAngle = endAngle }); }
/***************************************************/ public static void RenderWires(BHG.CoordinateSystem.Cartesian coordinateSystem, Rhino.Display.DisplayPipeline pipeline, Color bhColour) { pipeline.DrawConstructionPlane(new Rhino.DocObjects.ConstructionPlane() { Plane = (coordinateSystem.ToRhino()), ThickLineColor = bhColour, ThinLineColor = Color.Black, GridLineCount = 10 }); }
/***************************************************/ /**** Public Methods - Curves ****/ /***************************************************/ public static BHG.Arc FromRhino(this RHG.Arc arc) { BHG.CoordinateSystem.Cartesian system = arc.Plane.FromRhino(); return(new BHG.Arc { CoordinateSystem = system, StartAngle = arc.StartAngle, EndAngle = arc.EndAngle, Radius = arc.Radius }); }
/***************************************************/ public static RHG.Plane ToRhino(this BHG.CoordinateSystem.Cartesian coordinateSystem) { if (coordinateSystem == null) { return(default(RHG.Plane)); } return(new RHG.Plane(coordinateSystem.Origin.ToRhino(), coordinateSystem.X.ToRhino(), coordinateSystem.Y.ToRhino())); }
/***************************************************/ public static bool IsEqual(this BHG.CoordinateSystem.Cartesian bhCoordinates, RHG.Plane rhPlane, double tolerance = BHG.Tolerance.Distance) { if (bhCoordinates == null & rhPlane == default(RHG.Plane)) { return(true); } return(bhCoordinates.Origin.IsEqual(rhPlane.Origin, tolerance) && bhCoordinates.X.IsEqual(rhPlane.XAxis) && bhCoordinates.Y.IsEqual(rhPlane.YAxis) && bhCoordinates.Z.IsEqual(rhPlane.ZAxis)); }
/***************************************************/ public static void RenderMeshes(BHG.CoordinateSystem.Cartesian coordinateSystem, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material) { return; }