Grasshopper

algorithmic modeling for Rhino

Hi,
This should be a simple Rhino Common/SDK question. How do I bring in a polyline from GH to the VB.net? I get the following cast errors thrown.

GH Workspace -> VB.net type hint -> Error

"Referenced polyline Curve" -> "polyline -> "Unable to cast object Rhino.Geometry.Polyline to Type rhino.geometry.Curve"

Why does the VB.net component try to convert it to a curve? Is there a robust way to bring in curves into the VB.net component?

Any directions to the appropriate Rhino Common SDK page would be helpful

Thanks

Views: 1220

Replies to This Discussion

Hi Kermin,

I see it, it's a bug. Changing the type hint doesn't cause the script to recompile, and the old code was still set up for the previous type hint.

You'll have to open up the script source, make a change (like, add a blank line somewhere), then close the script again. Now it should work. Can you confirm?

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Yes, I think that was the problem. That was confusing but now I know.

On this topic, is curve a higher level object compared to "polyline". In other words, I can cast a GH polyline to a curve OR a polyline it seems. How should I be deciding which kind of geometry I should work with within the VB.net component?
If you can be 100% certain that you'll always get polylines, you can set the type-hint to Polyline. If you can be 100% certain you'll always get circles, you can use a Circle type-hint.

If you cannot be certain, or if it doesn't matter, you should revert to the more basic type of Curve.

A script which is only supposed to work on polylines might as well use that type-hint, as it's going to fail anyway if you don't supply a polyline.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service