Skip to content

Instantly share code, notes, and snippets.

@didimitrie
Created January 19, 2018 12:48
Show Gist options
  • Select an option

  • Save didimitrie/2635d9f94b63159cf2a37edc31404989 to your computer and use it in GitHub Desktop.

Select an option

Save didimitrie/2635d9f94b63159cf2a37edc31404989 to your computer and use it in GitHub Desktop.
namespace SpeckleNMT_Converter {
public static class SpeckleTypeExtensions
{
// will add a .ToSpeckle() method on RobertPoints
public static SpecklePoint ToSpeckle(this RobertPoint point)
{
return new SpecklePoint() { X = point.X, Y = point.Y, Z = point.Z };
}
//and the reverse:
// will add a ToNative() method on SpecklePoints, which will return a
// RobertPoint.
// These can coexist with potentially other ToNative mehtods, as long as they return different
// object types, ie a ToNative() that returns Point3ds from rhino.
public static RobertPoint ToNative(this SpecklePoint point)
{
return new RobertPoint(...);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment