algorithmic modeling for Rhino
I have a gh python script feeding GUIDs out as strings. It can be viewed here:
https://gist.github.com/1019295
Because I don't know how to make a DataTree object using Python (is that possible? Can I instantiate gh classes with IronPython?), I tie the "branches" of GUIDs together by joining them into strings, using commas as separators.
Using Grasshopper, I then split the GUID strings, into lists of GUIDs. However the conversion from GUID to geometry seems to intermittently fail, and I'm not sure why.
If I pass one of these lists of GUIDs through a geometry parameter component, it may convert the first time, or it may show a conversion error but output the correct geometry, or it may show a conversion error and output no geometry. I'm guessing this is either a bug in the conversion from GUID to geometry, or something in my script that is grabbing the GUIDs of nonexistent (perhaps deleted?) objects or invalid geometry.
pictures attached.
Tags:
What are the errors you see exactly?
Alternatively, you could try using the Grasshopper data casting logic, see if it works outside of the Curve parameter. Have a look at the following methods, they might be useful:
The Curve parameter calls ToGHCurve(), which in turn will create a Referenced curve if it's determined that the input data is a Guid. If this curve subsequently fails to load 'itself' from the document a conversion error will be thrown.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
To elaborate, the GH_Convert class is rather extensive and handles a cr*pload of conversions. It's also highly optimized using a minimum of reflection and lots of type jump tables to quickly reverse engineer data into it's proper form. If there is a bug in this class it needs to be found as it is used everywhere.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
The error I'm getting is:
"Data conversion failed from Guid to Curve" (that's what all the red parameters say)
though it might be Surface or whatever. There seems to be no clear pattern as to when it the error is thrown. I'll mess with it some more and get back to you.
Also, yes it does handle a mega-cr*pload of conversions! It's one of the coolest aspects of Grasshopper's functionality in my opinion. I've used parameters to recast all sorts of things. one of my favorite uses of this is to convert geometry into strings and then use string comparisons to filter geometry types.
I made a mistake in my original post:
It always converts successfully but sometimes shows an error when it does so. So it works fine, but is a little confusing (showing an error despite working fine).
The parameter that failed to convert was trying to turn points into a curve (stupid me).
Using a "Geometry" parameter, however, always seems to work with no errors.
Hi Benjamin,
could you please post a definition to test?
(right now I think that maybe some geometry is invalid and therefore is not added to the document?)
> Can I instantiate gh classes with IronPython?
Yes, we should be able to. An example is here.
- Giulio
________________
giulio@mcneel.com
McNeel Europe
attached.
> Can I instantiate gh classes with IronPython?
Yes, we should be able to. An example is here.
That is sooo cool!!!!!!
Trying to open this but I cannot load the Python component at present (sandboxing exception)...
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
considered the authorship of the reflection-load API, you probably know this... :)
There should be as usual these two options: either turn on "memory load" (COFF) or right click the component file (.gha) and choose "Unblock".
- Giulio
________________
giulio@mcneel.com
McNeel Europe
Is that something I can help with? Did I upload something wrong or leave strange components in the definition? Let me know if I should do something different.
Thank you!
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
© 2024 Created by Scott Davidson. Powered by