Grasshopper

algorithmic modeling for Rhino

Accessing standard Grasshopper functionality from within a script.

I am just starting out with GH scripting, and want to move into component development. I am hoping I could keep all logic insular within the script.

My question is - with standard components like - Polygon Center, Deconstruct Brep, Brep Edges etc... how would one get this data within C#/VB script?

Is it possible to invoke those components programmatically?

Views: 355

Replies to This Discussion

This is what u need to search.

Saltamontes SDK

Rhinocommon

And for start, maybe here.

Wiki McNeel

It is not easy to use functionality inside other components, it's often less work (and faster to boot) to just duplicate the functionality.

So would I be correct to for instance - get edges of a surface with something like:

private void RunScript(Surface S, ref object A) {
 var ns = S.ToNurbsSurface();
 var c1 = ns.InterpolatedCurveOnSurfaceUV(...);

 ..
}

?

No. A Surface in RhinoCommon doesn't support trimming information, so if you import your shapes as Surface types you lose this data. You'll have to import them as Brep to retain any trimming data. Then you iterate over all the edges in the brep to get the curves out.

If you know you'll never have trims, then you can revert to surfaces. However interpolating curves on a surface is definitely taking the long way round. You can extract isocurves from the surface which (when the UV points are at the surface domain extremes) represent the boundaries. The IsoCurve() method is available on all surfaces, you do not have to convert them to nurbs surfaces first.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service