Object clash detection

Dear forum,

I am trying to look for an automatic way to determin whether or not objects are in each others way. In other words, I try to detect object clashes, but I don’t succeed :frowning:

I have two arrays with objects. When I try to detect a clash using a macro in Rhino script, this returns a result:

For intIndex = 0 To UBound(arrTemp1)
Rhino.Command("_SelNone")
		Rhino.Command("_Clash _SelID " & arrTemp1(intIndex) & " _Enter _SelID " & arrTemp2(0) & " _Enter 25 _Enter")
Next

However, doing what I thought was equivalent in Rhinoscript does not work:

For intIndex = 0 To UBound(arrTemp1)
    Rhino.Command("_SelNone")
		arrTemp = Rhino.ObjectClash(array(arrTemp1(intIndex)), array(arrTemp2(0)), 25)
	Next

Resulting arrTemp always is null, even with the objects that caused a clash using the macro call. I also tried calling the method with both arrays of objects first instead of calling the array objects one by one, placing them again in an array

My very first attempt was

arrTemp = Rhino.ObjectClash(arrTemp1, arrTemp2, 50)

but that is also always null…

Any suggestion what I did wrong?

Kind regards,

Filip

Don’t have an answer for your post just an FYI. The RhinoBIM plug-in already has a clash detection function built in and it works on any Rhino object. It has the ability to set clearances for objects, and reports hard, touch or soft clash.

The RhinoScript solution worked for me on a couple of overlapping boxes. Perhaps we need to see some geometry and perhaps some sample code.

Note, The RhinoBIM tool uses the same tool as RhinoScript and the Clash command…

1 Like

I also can’t get RS Clash method to work. It always returns Null

jonah

Same here. Always Null.
RS Help file also says:
see the Rhino help file for details on the Clash command.
I don’t have a Clash command (in Rhino Help or Rhino in general…)

anyone got this to work ?

thanks,

–jarek

Actually, just run the command Clash and follow command-line instructions, it’s an unconventional command UI wise and as you can see it does do some interesting clash detection with probably not a lot of overhead.

@dale, can you or someone else elaborate on Clash and if it can be exposed in rhinocommon. I remember getting info in the past about Clash not being very accurate or reliable in all cases, is that so? I see at least one issue with extrusions that seem to catch only clash points(see images below)

Thanks
-Willem

Oh I see now. It does not Autocomplete (Rh 5.12), and not present in Help file, but you are right, works quite nicely. Can you get the scripted version to wotk? (RS). ?

thanks,

–jarek

Dunno maybe Clash is using the MeshClash method with objects’ render meshes…?

http://4.rhino3d.com/5/rhinocommon/?topic=html/AllMembers_T_Rhino_Geometry_Intersect_MeshClash.htm

–Mitch

Even without using extrusions, the result between a sphere and a box seems completely off-base…

–Mitch

AFAIK:
Clash is not supposed to calculate intersection geometry but merely if the input clashes and as such it’s only indicating where a clash was found.
Setting a higher clearance distance shows this:

-Willem

We added a Clash detector in Grasshopper component in addition to the RhinoCommon method for Clash. Here is some evolving documentation on the feature.

We are looking for feedback on the methods:

  1. Does it find the clashes you need?
  2. Is it fast enough?

Another really fun part about Clash is that it will work on Revit elements using Rhino.Inside.Revit

1 Like

It is possible to add two more features to this Clash detection command?

One is the ability to use also Curves and surfaces (mixed) and the other is to move an object (curve or geometry) until it clashes with a surface.

What are you using it for? Do you have some examples?

I have seen routines that move objects under clash conditions. There are lots of ways to prototype something.

this would be very useful i was searching for this last time i tried to optimize bridge wifth until clearance limit is reached. of course you can use halapagos but this loop could be done in one single component without any macrooptimization loop

The challenge is that specific objects have limited directions they can move. So each situation is different.

Do you have a sample model?

I discontinued to elaborate that script some time ago. There is nothing to show.

It was just an idea how some things would be nicer to get done.

I am thinking of a component where you would assign geometry to move then collision geometry as another input, then allowable directions of motion (list of vectors), some options like tolerancies and the component would move the geometry just according to those rules which would be the output.

lets say you have railing as geometry to move, some polysurface which represents train clearance corridor. you want to move that railing to be exactly 10cm off the corridor in desired direction (for example perpendicular to railing dir and parralel to wxy).

There are many possibilities what to do, there could even be rotation included to satisfy conditions of clash. It gets complex very quickly you start to think about it :d

Yes, it get complex in the general case. But in specific cases I bet something much simpler would work.

Here is an interesting project that uses some of the logic you are looking at: https://github.com/clash-buster/clash-buster

I do not think it would be difficult to write a python component that moved an object until, it did not clash.

There are some threads about doing this: https://www.grasshopper3d.com/forum/topics/if-intersect-then-move

But probably writing a more current Python component might be fun. What would the inputs be?

Inputs:

  1. Object to move
  2. Clashing object
  3. Direction for move
  4. Unit for each step

Output:

  1. Objects new location
  2. Amount moved to clear
1 Like

Just popped up today this situation. I do need to move the top right curve on the Z direction until it’s touching the underside curve.

move_until_colide.3dm (7.7 KB)

And this is a basic sample. Now for the geometries it is way more complicated.

Example.