Grasshopper

algorithmic modeling for Rhino

This is probably easy for seasoned scripters, but for a noob like me it's a 10+ hour adventure.

 

I am attempting to write a vb.net component which will do a variety of things with breps.

I've had some success in the past with writing the code, but I am constantly getting hung-up on a couple of points.  The first are the Classes (I guess that's what they are called.)

 

I have a couple of different classes.  The two or three I am focusing on are:

Brep

BrepFaces

and

Surface

 

What's so troublesome is trying to convert the member of one class to another.

 

What I really want to do:

Convert a Brep.Faces.ExtractFaces(1) to a Surface so I can get the centroid.

And

Convert a list of Brep.Faces.ExtractFaces to a BrepFace

 

 

I am so lost.

Views: 4526

Replies to This Discussion

You can access BrepFaces via the Faces property of a Brep instance:

Dim B as Brep = 'somebreporother

Dim F As BrepFace = B.Faces(0)

BrepFace has a DuplicateFace() method that creates a new Brep that looks just like that one face. You'll probably need this if you want to find areas and centroids of trimmed faces.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Forgive me; I need a lot of help.

 

Let's assume the following:

1.  I have a vb.net component

2.  I have one input (brep)

3.  I have one solid brep consisting of 6 faces

 

Here's what I haven't figured out.

 

1.  How do I find the centroid of these six faces

2.  How do I isolate (output) the two faces which have the highest and lowest centroid z-vales

 

I've spent so much time trying to figure these simple things out (primer, online research, rhino common sdk, everything...) but I am completely lost.

Attached is an example with commented code.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks David.

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