// Back again only to LINECURVES because we hate grasshopper and its dealings with rhinocommon public LineCurve LineToNative(Line line) { var myLine = new LineCurve(PointToNative(line.start).Location, PointToNative(line.end).Location); myLine.Domain = line.domain == null ? new RH.Interval(0, line.length) : IntervalToNative(line.domain); return(myLine); }
public CurveArray PolylineToNative(Polyline polyline) { var curveArray = new CurveArray(); if (polyline.value.Count == 6) { curveArray.Append(LineToNative(new Line(polyline.value, polyline.units))); } else { var pts = polyline.points; for (var i = 1; i < pts.Count; i++) { var speckleLine = new Line(new double[] { pts[i - 1].x, pts[i - 1].y, pts[i - 1].z, pts[i].x, pts[i].y, pts[i].z }, polyline.units); curveArray.Append(LineToNative(speckleLine)); } if (polyline.closed) { var speckleLine = new Line(new double[] { pts[pts.Count - 1].x, pts[pts.Count - 1].y, pts[pts.Count - 1].z, pts[0].x, pts[0].y, pts[0].z }, polyline.units); curveArray.Append(LineToNative(speckleLine)); } } return(curveArray); }
/// <summary> /// SpeckleLine to DS Line /// </summary> /// <param name="line"></param> /// <returns></returns> public DS.Line LineToNative(Line line) { var pts = ArrayToPointList(line.value, line.units); var ln = DS.Line.ByStartPointEndPoint(pts[0], pts[1]); pts.ForEach(pt => pt.Dispose()); return(ln.SetDynamoProperties <DS.Line>(GetDynamicMembersFromBase(line))); }
/// <summary> /// DS Line to SpeckleLine /// </summary> /// <param name="line"></param> /// <returns></returns> public Line LineToSpeckle(DS.Line line) { var l = new Line( PointListToFlatArray(new DS.Point[] { line.StartPoint, line.EndPoint }), ModelUnits); CopyProperties(l, line); return(l); }
public Line LineToSpeckle(DB.Line line) { var l = new Line() { value = new List <double>(), units = ModelUnits }; l.value.AddRange(PointToSpeckle(line.GetEndPoint(0)).value); l.value.AddRange(PointToSpeckle(line.GetEndPoint(1)).value); return(l); }
/// <summary> /// SpeckleLine to DS Line /// </summary> /// <param name="line"></param> /// <returns></returns> public DS.Line LineToNative(Line line) { var ptStart = PointToNative(line.start); var ptEnd = PointToNative(line.end); var ln = DS.Line.ByStartPointEndPoint(ptStart, ptEnd); ptStart.Dispose(); ptEnd.Dispose(); return(ln.SetDynamoProperties <DS.Line>(GetDynamicMembersFromBase(line))); }
// 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); }
// Back again only to LINECURVES because we hate grasshopper and its dealings with rhinocommon public LineCurve LineToNative(Line line) { var pts = PointListToNative(line.value, line.units); var myLine = new LineCurve(pts[0], pts[1]); if (line.domain != null) { myLine.Domain = IntervalToNative(line.domain); } return(myLine); }
/// <summary> /// DS Line to SpeckleLine /// </summary> /// <param name="line"></param> /// <returns></returns> public Line LineToSpeckle(DS.Line line, string units = null) { var u = units ?? ModelUnits; var l = new Line( PointListToFlatArray(new DS.Point[] { line.StartPoint, line.EndPoint }), u); CopyProperties(l, line); l.length = line.Length; l.bbox = BoxToSpeckle(line.BoundingBox.ToCuboid(), u); return(l); }
public Line LineToSpeckle(DB.Line line, string units = null) { var u = units ?? ModelUnits; var l = new Line { units = u }; l.start = PointToSpeckle(line.GetEndPoint(0), u); l.end = PointToSpeckle(line.GetEndPoint(1), u); l.length = line.Length; return(l); }
public Line LineToSpeckle(DB.Line line, string units = null) { var u = units ?? ModelUnits; var l = new Line { units = u }; l.start = PointToSpeckle(line.GetEndPoint(0), u); l.end = PointToSpeckle(line.GetEndPoint(1), u); l.domain = new Interval(line.GetEndParameter(0), line.GetEndParameter(1)); l.length = ScaleToSpeckle(line.Length); return(l); }
// 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); }
public Objects.Geometry.Line GetBottomLine(List <Node> nodes) { Objects.Geometry.Line baseLine = new Objects.Geometry.Line(); double lowest_elv = nodes.Min(nodes => nodes.basePoint.z); List <Node> nodes1 = nodes.FindAll(node => node.basePoint.z.Equals(lowest_elv)); if (nodes1.Count == 2) { var point1 = nodes1[0].basePoint; var point2 = nodes1[1].basePoint; baseLine = new Geometry.Line(point1, point2, point1.units); return(baseLine); } return(null); }
public ICurve PolylineToSpeckle(RH.Polyline poly, Interval domain) { if (poly.Count == 2) { var l = new Line(PointsToFlatArray(poly), ModelUnits); l.domain = domain; return(l); } var myPoly = new Polyline(PointsToFlatArray(poly), ModelUnits); myPoly.closed = poly.IsClosed; if (myPoly.closed) { myPoly.value.RemoveRange(myPoly.value.Count - 3, 3); } myPoly.domain = domain; return(myPoly); }
// 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); }
public static SpeckleLine LineToSpeckle(TopSolid.Kernel.G.D3.Curves.LineCurve TSLine) { SpeckleLine SpLine = new SpeckleLine(PointToSpeckle(TSLine.Ps), PointToSpeckle(TSLine.Pe)); return(SpLine); }
public DB.Line LineToNative(Line line) { return(DB.Line.CreateBound( PointToNative(line.start), PointToNative(line.end))); }
public DB.Line LineToNative(Line line) { return(DB.Line.CreateBound( new XYZ(ScaleToNative(line.value[0], line.units), ScaleToNative(line.value[1], line.units), ScaleToNative(line.value[2], line.units)), new XYZ(ScaleToNative(line.value[3], line.units), ScaleToNative(line.value[4], line.units), ScaleToNative(line.value[5], line.units)))); }
// Line // Gh Line capture public Line LineToSpeckle(RH.Line line) { var sLine = new Line(PointsToFlatArray(new Point3d[] { line.From, line.To }), ModelUnits); return(sLine); }