Grasshopper

algorithmic modeling for Rhino

stupid qusation -how to make GHP_vb script to understand rhinoscript commands ?


Views: 435

Replies to This Discussion

so on
or - for a concrete subject - how to do "sellayer" command in grasshopper VB
Are you using the new RhinoCommon SDK or the old Rhino_DotNET SDK?

--
David Rutten
david@mcneel.com
Poprad, Slovakia
errr
old one - in v0.6
but if it not so hard 0 it will be interesting to know both
In Rhino_DotNET SDK I'd do it as follows:


Dim it As New MRhinoObjectIterator(doc)
Dim obj As IRhinoObject = it.First()

Do
If (obj Is Nothing) Then Exit Do
If (obj.Attributes().m_layer_index = Li) Then
obj.Select(True, True, True)
End If

obj = it.Next()
Loop


Where Li is the layer index.

In RhinoCommon I've never actually done anything with layers yet, so I don't know for sure if there's a shortcut way of doing it. I'd expected to find functions for this on the Layer class, but nothing there. If Steve confirms that these kinds of functions are missing I'll add them to the new SDK.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
oh
and one more - how to get layer index from layer name?
or even how to know layer index...
doc.m_layer_table.FindLayer("MyLayerName")

--
David Rutten
david@mcneel.com
Poprad, Slovakia
and how to output this?
I put A=obj outside the loop. then inside.... nothing happens
I don't get it... what's to output? You're selecting a bunch of objects in the Rhino document.

Or did you mean "convert all the geometry on a specific Rhino layer into Grasshopper geometry" when you said "select"?

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ok, assuming you want to harvest the geometry in a Rhino layer, I attached a script that does that. However, there appears to be a bug in the function that converts an Object ID into a Grasshopper geometry type, so unfortunately the remaining option is to convert the geometry directly, which means this script has to be a RhinoCommon script.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Attachments:
Hi David,
What s the difference between RhinoCommon SDK or Rhino_DotNET SDK ?
Thanks,
Arthur
Rhino_DotNET.dll was the first .NET SDK we provided. It was developed over the Rhino3 cycle and has been marginally improved since.

For Rhino5 (and, in the special case of Grasshopper, for Rhino4) we have been writing a new SDK. This time we're writing it by hand instead of converting C++ SDK header files using python scripts so it should be a lot friendlier to work with. Further details can be found here:

http://wiki.mcneel.com/developer/rhinocommon

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

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service