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