// Box public Box BoxToSpeckle(RH.Box box, string units = null) { var u = units ?? ModelUnits; var speckleBox = new Box(PlaneToSpeckle(box.Plane, u), IntervalToSpeckle(box.X), IntervalToSpeckle(box.Y), IntervalToSpeckle(box.Z), u); speckleBox.area = box.Area; speckleBox.volume = box.Volume; return(speckleBox); }
// Line // Gh Line capture public Line LineToSpeckle(RH.Line line, string units = null) { var u = units ?? ModelUnits; var sLine = new Line(PointToSpeckle(line.From, u), PointToSpeckle(line.To, u), u); sLine.length = line.Length; sLine.domain = new Interval(0, line.Length); var box = new RH.Box(line.BoundingBox); sLine.bbox = BoxToSpeckle(box, u); return(sLine); }
// Rh Line capture public Line LineToSpeckle(LineCurve line, string units = null) { var u = units ?? ModelUnits; var sLine = new Line(PointToSpeckle(line.PointAtStart, u), PointToSpeckle(line.PointAtEnd, u), u) { domain = IntervalToSpeckle(line.Domain) }; sLine.length = line.GetLength(); var box = new RH.Box(line.GetBoundingBox(true)); sLine.bbox = BoxToSpeckle(box, u); return(sLine); }
// Rh Capture public Base PolylineToSpeckle(PolylineCurve poly, string units = null) { var u = units ?? ModelUnits; RH.Polyline polyline; if (poly.TryGetPolyline(out polyline)) { var intervalToSpeckle = IntervalToSpeckle(poly.Domain); if (polyline.Count == 2) { var polylineToSpeckle = new Line(PointsToFlatArray(polyline), u) { domain = intervalToSpeckle }; polylineToSpeckle.length = polyline.Length; var box = new RH.Box(poly.GetBoundingBox(true)); polylineToSpeckle.bbox = BoxToSpeckle(box, u); return(polylineToSpeckle); } var myPoly = new Polyline(PointsToFlatArray(polyline), u); myPoly.closed = polyline.IsClosed; if (myPoly.closed) { myPoly.value.RemoveRange(myPoly.value.Count - 3, 3); } myPoly.domain = intervalToSpeckle; myPoly.bbox = BoxToSpeckle(new RH.Box(poly.GetBoundingBox(true)), u); myPoly.length = poly.GetLength(); return(myPoly); } return(null); }
// Box public Box BoxToSpeckle(RH.Box box) { var speckleBox = new Box(PlaneToSpeckle(box.Plane), IntervalToSpeckle(box.X), IntervalToSpeckle(box.Y), IntervalToSpeckle(box.Z), ModelUnits); return(speckleBox); }