Grasshopper

algorithmic modeling for Rhino

I am trying to write a vb.net component (using the vb.net compatibility version of the component) that does the solid intersection function.  I am having trouble understanding how to take the input Breps and convert them to IOnBreps for use in the RhinoBooleanIntersection command.  Below is my code so far:  

 

 

Private Sub RunScript(ByVal BR1 As OnBrep, ByVal BR2 As OnBrep, ByRef A As Object)

Dim bresult As Boolean = False

'Code here to take BR1 and BR2 and create IOnBreps to pass to boolean intersection function'

Dim blist As OnBrep()

Dim ret As Boolean = Rhutil.RhinoBooleanIntersection(brep1, brep2, 0.01, bresult, blist)

A = blist

End Sub

 

Can anyone assist me with what I need to do with BR1 and BR2 to be able to send them the Intersection function?  

 

Thanks.  

Views: 457

Replies to This Discussion

Hi Larry,

 

it's been so long since I used the Legacy SDK that I'm totally rusty. Any reason you can't switch to RhinoCommon?

 

To answer your question, an OnBrep is an IOnBrep. IOnBrep is an interface, OnBrep is a class that implements that interface, and adds a few extra bits and pieces.

 

Every function that requires IOnBreps will happily accept OnBreps. Every function that requires OnBreps will not accept IOnBreps.

 

The way to think about this is that IOnBrep represents the concept of cars, while OnBrep represents a Honda Civic. If you have a function called CrashCar(), it will accept anything that implements the Car interface, including your Honda Civic. If however you have a function that only works on Honda Civics, it can't accept just any car.

 

The weird thing is that you're writing in a language that is compiled. Which means that if you have a function that only accepts Honda Civics, and you feed it a Honda Civic, but that Honda happens to be declared as a Car, it won't work. But that's not your problem here.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David, 

 

Thanks for reply and explanation.  

I was thinking that RhinoCommon was only for V5 and I am still using grasshopper with V4.  However after checking the RhinoCommon wiki page, I realized the implementation in grasshopper works with V4, so I switched over to using the rhinocommon component and got my code working.

 

Larry 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service