Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I have a question regarding referencing faces of geometry in Python.

I wanted to reference the face of the geometry so that if an a line or vector is near the face of the surface, the surface will be identified as surface A.

So, what I did in Python is have a brep as an input and then deconstructing the brep into faces. But I'm not too sure on how to set the conditions. At first I thought of finding the distance of the face and the vector/line. But the distance command in Python can only search the distance between 2 points. Can someone give me a suggestion regarding this? Thank you. I would appreciate your help.

Views: 664

Replies to This Discussion

You do it like you would in Grasshopper with the sort component. In c# I would do a loop of the distances from each face to the line to collect all the distances. Then sort the faces by the distances. (Sort items by keys) Then face [0] of your sorted face list will be the closest. I don't know python but sorting seems similar to c#. https://wiki.python.org/moin/HowTo/Sorting

Hi Michael,

I see, thank you very much for your advice. It's very helpful and I am able to do it now.

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