Grasshopper

algorithmic modeling for Rhino

Hey guys,
I have this scene where these multiple meshes are stacked on top of each other(not intersecting) and i have set the multiple meshes to one mesh component. What i want to do is to find a way to evaluate/analyse the list to see which meshes are colliding amongst each other and then i plan on extracting their points of contact (in the form of polyline curves) through the "MeshMeshIntersection" and group/merge all points of contact as one data set. 
I already used the collide many|many component to figure out which mesh is colliding with which and i can also see where there points of contact are but one collision at a time. But I'm looking for a smarter way to streamline the process of detecting the points of contacts between these meshes.I would really appreciate if you guys give me suggestions on how to do this. From what i can think of right now is that i would probably need to make a python component and run the lists there. If anyone could give me any feedback it would be super useful.
Thank you

Views: 978

Replies to This Discussion

Hi Fawad,

Try this one.

The branch number corresponds to the particular mesh. Example: Seventh mesh from the list (green one from the photo bellow), intersects itself with another three meshes, which means it has three polylines (pink on the photo). These polylines could be found on branch {6}.

Attachments:

Hey Djorjde,

Thanks a lot for the reply, I just have a small question, i opened the script and its giving me this error

"Runtime error (MissingMemberException): 'LightException' object has no attribute 'Kernel'

Traceback:
line 4, in script"

Do you know how I might be able to resolve this? 

Thank you again! 

I would say you are using an older version of GhPython (0.5.1.0).
Try downloading the newest one from food4rhino.

ok my bad! now its running perfectly. 

Thank you so much for this! 

If its not too much to ask, can you briefly explain what you did in the python script. Since i'm a beginner I am still learning how

specifically the "if i != j:" command? is that some sort of cull boolean? 

I can't stress how helpful this can be.. 

thank you

"i != j" is sorta cull: it's a condition.

It the broad context of upper "for loop", it means: take one mesh, and then intersect it with all the other meshes, but not with itself (because intersecting it with itself would result in intersection curves too).

The "newTree, GH_Path and AddRange" parts create the data tree, and add data to it's branches.

"if len(polyline) != 0:" is also a condition, and eliminates the results of those meshes which do not intersect among themselves:
If the intersection between two meshes is successful, then rs.MeshMeshIntersection() function returns those intersection curves, as a list of polylines. If intersection between two meshes is not successful, then the function returns an empty list (in contrary to what stands in the help file - None. It's a typo). We get rid of all these empty lists by applying the condition that only lists which length is not equal to zero, could be added to the data tree.

Wow that is pretty amazing!

Couldn't have imagined it any other way. 

Its Mindblowing how helpful you've been

Thank you!

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service