algorithmic modeling for Rhino
I have been able to get around it by first casting to a string, and then using GH_Path.SplitPathLikeString to get a string array which can then be used to construct a new GH_Path, but it seems like a poor approach.
Yeah it seems I never wrote conversion methods for X -> GH_Path.
If you have an IGH_Goo instance, then you can test:
IGH_Goo goo = ...;
GH_Path path = null;
GH_StructurePath pathGoo = goo as GH_StructurePath;
if (pathGoo != null)
path = pathGoo.Value;
else
{
path = new GH_Path();
if (!path.FromString(goo.ToString())
throw new ArgumentException("Data is not a path");
}
Not very pretty either, but FromString is definitely to be preferred over the more utilitarian SplitPathLikeString. Unfortunately FromString is not a static method so you have to construct a new GH_Path first.
ps. Just another example of how utterly horrible the GH1 SDK truly is...
Cool. Thanks! That looks cleaner and more sensible than what I've been doing.
Well, I don't know if its all that bad after all. It's just like a big laboratory.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by