Grasshopper

algorithmic modeling for Rhino

Collision test between solid objects (genoform)

Hello Guys,

I'm doing a definition for an light/art-object in a very tall atrium. The basic Idea is to have a bunch of ceramic pipes rotated randomly from which a couple of them will become light tubes. I'm using the genoform plug-in to evaluate different proposals of random rotations.

The problem is that I know some of tubes are intersecting each other, this can not happen in a physical situation. So I'll like to create a test that excludes (Boolean operation) those tubes that intersects.

Any Idea

Cheers

Views: 1611

Attachments:

Replies to This Discussion

Try something like this:


Private Sub RunScript(ByVal c As List(Of Curve), ByVal r As Double, ByRef A As Object)

Dim intersect As Boolean = True

While intersect
intersect = False

For i As Integer = 0 To c.Count - 2
For j As Integer =i + 1 To c.count - 1
Dim pta, ptb As point3d
c(i).ClosestPoints(c(j), pta, ptb)
Dim dist As Double = pta.DistanceTo(ptb)
If dist / 2 < r Then
intersect = True
c.RemoveAt(i)
Continue While
End If
Next
Next
End While
a = c

End Sub

Create a vb component, name an input 'c' and set it as list of curves, name another input r and set it as double. Input a list of lines that represent the axis of the pipes into 'c' and input a number value to 'r' that is the radius of the pipes. The code checks for each line if it intersects with any other line (it checks if half of the closest distance between the two lines is smaller than r). If it does, it deletes the line from the list and starts again.
The output would be a smaller list of lines that don't intersect each other.

Hello Vicente Thank youfor your help. I'm not very familiar with scripting but I think I managed to create the vb component with thE ABOVE CODE. But I get an error (please see image)

Thank you for your help

cheers

Right click on the 'c' input and set it as 'list'.

Great Thank you Vicente It works perfectly.

Cheers

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