Grasshopper

algorithmic modeling for Rhino

I would like to sort different geometries within a VB component.
I have tried something like this and that do not work.,,

if someinput is oncurve then,,,,
if some input is onBrep then,,,,

Can someone help me out,,
Thanks

Views: 213

Replies to This Discussion

Hi Stig,

do you want to determine if some generic variable of type Object is an OnCurve or an OnBrep?

--
David Rutten
david@mcneel.com
Seattle, WA
Well the input must be a generic object (I've asked David for a generic OnObject/OnGeometry input option), and then you can test the type. There are only a few methods which almost every object implements, and one of those is GetType. What I do (which is probably slightly off) is get that type and convert it to a string, then test that against what I'm looking for. Like so...

Dim inputType as string = myInput.GetType().ToString

If inputType = "RMA.OpenNURBS.OnBrep" Then
'Its a brep...do something
ElseIf inputType = "RMA.OpenNURBS.OnCurve" Then
'Its a curve...do something else
Else
'Its not what I want...take it back
End If

HTH
Hi Damien, thanks for your reply

It works great. I would never have figured that out myself.

I'm trying to do a ghx which sort different floor slabs of curves and breps into diff. y positions

I attached a screendump.

Stig
Attachments:

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