// Back again public static LineCurve ToNative(this SpeckleLine line) { var myLine = new LineCurve(line.Start.ToNative().Location, line.End.ToNative().Location); myLine.UserDictionary.ReplaceContentsWith(line.Properties.ToNative()); return(myLine); }
// Back again only to LINECURVES because we hate rhinocommon public static LineCurve ToNative(this SpeckleLine line) { var pts = line.Value.ToPoints(); var myLine = new LineCurve(pts[0], pts[1]); myLine.UserDictionary.ReplaceContentsWith(line.Properties.ToNative()); return(myLine); }
/// <summary> /// SpeckleLine to DS Line /// </summary> /// <param name="line"></param> /// <returns></returns> public static Line ToNative(this SpeckleLine line) { var pts = line.Value.ToPoints(); var ln = Line.ByStartPointEndPoint(pts[0], pts[1]); pts.ForEach(pt => pt.Dispose()); return(ln.SetSpeckleProperties <Line>(line.Properties)); }
/// <summary> /// /// </summary> /// <param name="line"></param> /// <returns></returns> public static SpeckleUnityPolyline ToNative(this SpeckleLine line) { Vector3[] points = line.Value.ToPoints(); if (points.Length == 0) { return(null); } line.Scale(scaleFactor); return(new SpeckleUnityPolyline(line.Type, points)); }
public static SpeckleLine ToSpeckle(this BHG.Line l) { if (l == null) { return(default(SpeckleLine)); } SpeckleLine speckleLine = new SpeckleLine( new double[] { l.Start.X, l.Start.Y, l.Start.Z, l.End.X, l.End.Y, l.End.Z } ); return(speckleLine); }
public static string ToNative(this SpeckleLine inputObject) { var convertedObject = new Structural1DElement(); foreach (var p in convertedObject.GetType().GetProperties().Where(p => p.CanWrite)) { var inputProperty = inputObject.GetType().GetProperty(p.Name); if (inputProperty != null) p.SetValue(convertedObject, inputProperty.GetValue(inputObject)); } return convertedObject.ToNative(); }
public StructuralAssembly(double[] value, string[] elementRefs, SpeckleLine baseLine, SpecklePoint orientationPoint, int numPoints = 0, double width = 0, string applicationId = null, Dictionary <string, object> properties = null) { if (properties != null) { this.Properties = properties; } this.ApplicationId = applicationId; this.ElementRefs = elementRefs.ToList(); this.Value = value.ToList(); this.OrientationPoint = orientationPoint; this.NumPoints = numPoints; this.Width = width; this.BaseLine = baseLine; GenerateHash(); }
/// <summary> /// SpeckleLine to DS Line /// </summary> /// <param name="line"></param> /// <returns></returns> public static Line ToNative(this SpeckleLine line) { var pts = line.Value.ToPoints(); return(Line.ByStartPointEndPoint(pts[0], pts[1])); }
public static Line ToVerb(this SpeckleLine sLine) { var points = sLine.Value.ToVector3Array(); return(new Line(points[0], points[1])); }
public static GameObject ToNative(this SpeckleLine curve) { var verb = curve.ToVerb(); return(CurveToObject(curve._id, verb)); }
public static SpeckleLine ToSpeckleLine(this LinePayload payload) { var line = new SpeckleLine(payload.Coordinates); return(line); }