Grasshopper

algorithmic modeling for Rhino

Hi everybody!!! (it's my first post)
I’m struggling a little bit with VB component.

I’m trying to Shrink Trimed Surface to Edge, using VB component.
I’ve been reading SDK help, but is not clear to me.

Visual Basic
Public Function ShrinkSurface(face As OnBrepFace^%) As bool


I’ve written down this

Sub RunScript(ByVal x As OnBrep, ByVal y As Object)
A = onbrep.ShrinkSurface(x)

Somebody could tell me how to define a OnBrepFace variable?
It’s the same SrinkSurface and ShrinkSurfaceToEdge?

Thanks,
Carlos

Views: 4751

Replies to This Discussion

In general the SDK help doesn't really go far in explaining a whole lot of what it does, so I'm not surprised that the helpfile alone isn't making it. You have two options here if you want to shrink a brep...ShrinkSurface or ShrinkSurfaces. The first option, which your trying to use, is for shrinking a single face of a brep. Therefore you have to know which face of the brep you want to shrink, then tell rhino which one to shrink. The second option, is to just tell Rhino to shrink all of the surfaces that make up the brep. This is probably the easier way to do this, provided you don't mind if all the surfaces are shrinked.

In regards to defining an OnBrepFace, you don't have to worry about creating that yourself persay, since the OnBrep already contains all the OnBrepFaces that you'd need. Provided you knew what index was the face you wanted you could either use the brep's properties, or use the Face method...they'd both look pretty similar.

myBrepFace = myBrep.m_F(x) 'through properties
myBrepFace = myBrep.Face(x) 'using a method

I don't know what the similarities are between ShrinkSurface and ShrinkSurfaceToEdge...that's probably a question for David, Rajaa, or Steve
Thanks Damien,

It’s true that SDK help doesn’t explain to much. Perhaps some examples in the future version could be a good idea.
I’ve been trying to learn how to use it, but I think I’m missing the fundaments.
I found this link, the information is not complete but, perhaps, can be useful for people like me, who are starting on it.
https://community.nus.edu.sg/ddm/index.php?q=node/77

Reading what you have written, I’ve found my error.
The VB component was returning True or False (as it was written on the help!)

I paste here the code if any other people need it (very stupid, but a big step for me)
It works to shrink a surface, where A returns true successful false failure and B returns the shrinked surface.


A = x.ShrinkSurfaces
B = x

Thanks again.
Carlos.
Carlos,

Thanks for starting this topic. It's very timely for me.

David and Damien,

Time to jump in the VB waters... I'll see you at the NY cloud event in late October.

-taz
See you there Taz... look forward to meeting you.

Hi Carlos,

 

Thanks a lot for the script.

I am still having a red component saying null. Do you know what's happening?

 

 

 

ShrinkSurface will leave a sliver of surface if the trim curve is not parallel to an isocurve. ShrinkSurfaceToEdge will really shrink it as far as possible. ShrinkSurface is safer since it doesn't introduce cases where the surface edge and the surface trim intersect in a single point.

You can see the difference when using the ShrinkTrimmedSrf and ShrinkTrimmedSrfToEdge commands in Rhino.

--
David Rutten
david@mcneel.com
Seattle, WA
I'm trying to do this as well - does anyone have a simple, working vb component to shrink a trimmed surface?

I tried the code above, but get "Error: "ShrinkSurfaces' is not a member of 'Rhino.Geometry.Surface'

using gh 0.8.004

Hi Evan,

 

that's because a Rhino.Geometry.Surface is always a complete surface. It doesn't have any trimming curves. Therefore, it cannot be shrunk because it's always as big as it can possible get. A Brep however is one or more surfaces, where each surface can have any number of trimming boundaries.

 

So, you'll need to shrink Breps, not Surfaces.

 

One more bit of information, in Grasshopper I decided to use the term 'surface' for a brep with a single face. Meaning that Grasshopper 'surfaces' can have trims. But in order to achieve this they wrap around the Rhino.Geometry.Brep class, not the Rhino.Geometry.Surface class.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

My VB knowledge is pretty vague and I am still struggling with getting the "ShrinkSurfaceToEdge" to work. I tried the Faces.ShrinkFaces that was posted in another thread, but it cuts a kinky edge (like the mere "ShrinkSurface" command you already mentioned above). Also I tried what Carlos posted above - neither works. 

What would I need to put in the component to make it shrink to the edge?

Thanks so much,

Fabian

Attachments:

Hi David,

I am trying to implement the ShrinkSurface command within the VB component but I am getting an error (BC30456). Is there a dll I need to place somewhere to make this function?  I've been pouring over the forum and cant seem to find any current discussions on the topic and haven't found a solution in the Grasshopper Primer so far. Is there any direction you can point me? Thank you so much!

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