Grasshopper

algorithmic modeling for Rhino

Hi guys,

Im learning VB.net from introduction of second edition. Could someone tell me what's the difference between doc. and rhutil.? Seems like doc. is like rhino. in rhinoscript, can call some function after it. but rhutil. is something deeper than doc. is it true?

 On the page 99 there is a script shows how to print absolute tolerance, but it hasn't show anything while I did the same thing in my gh.Is it because I use the new version of gh..?

Views: 1116

Attachments:

Replies to This Discussion

Hi Taylor,

doc is short for "document". It is a class that offers access to a specific 3dm file. It allows you to add and retrieve objects from that file, access the layers, the linetypes, the materials etc. etc.

rhutil is a class that provides a wide array of static (Shared in VB) functions. These functions can be called anytime, anywhere as they are not tied to a specific instance of an object (that's what "shared" means).

In the new SDK (RhinoCommon), RhUtil no longer exists. Neither does OnUtil. We've put the shared functions on the types that seem to make the most sense, instead of lumping everything into a single bucket.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks David, but I feel lack of knowlage about some basic things.Is there some books could explain the frame and the rule of sentence of vb.net, like rhinoscript101 for rhinoscript?
If you're using a new version of GH, then the default scripting components now use Rhino Common not the old .Net SDK. You can still use the Legacy scripting components if you'd like to use the old SDK, so if you switch the code over to one of those legacy components, you'll likely get those examples from the primer to work.

The explanation of the Doc (MRhinoDoc to be more specific) and RhUtil classes below only pertain to the old .Net SDK, not any work being done with RhinoCommon. RhinoCommon does not have an equivalent to RhUtil as the functionality that it exposed has been implemented in the geometry classes where it made the most sense (i.e. creating an interpolated curve is now in the Curve class). RhinoCommon does have an equivlent to MRhinoDoc class (its called RhinoDoc), but is structured much differently.

Doc (an MRhinoDoc) and RhUtil are two separate classes within the Rhino SDK. They each do completely different things, and neither is at all related to anything in Rhinoscript. Doc is a reference to the Rhino document, which will allow you to reference certain things about the Rhino document and interact with it. Retrieving tolerance may be something you'd use a Doc reference for, or perhaps adding geometry back into the document.

RhUtil is a static class that contains a bunch of utility functions that typically perform some useful geometric calculation, such as creating an interpolated curve, booleaning two objects, or creating a sweep, just to name a few.
Thanks Damien, do you know where can i find some material to understand the meaning of those command in vb.net and what should i put after them because it doesnt show some help file and any hint at any where..Thanks.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service