ObjectClash only working for extrusions

I’m trying to adapt the example ObjectClash script - Rhino3d Object Methods - Object Clash - but the only geometry type that I can get to work are Extrusions. I’ve tried adjusting the geometry type filter, but with no success. Wondering if anyone has insight on how I can get this to work with closed polysurfaces or other geometry? Thanks.

Current script (i’ve left commented out lines to show a couple options i’ve tried):


Sub Main()
	'Const rhSurface = &h8
	Const rhSurface = 8
	
	'Const rhPolysrf = &h10
	Const rhPolysrf = 16

	'Const rhMesh = &h20
	Const rhMesh = 32

	'Const rhExtrusion = &h40000000
	Const rhExtrusion = 1073741824

	Dim arrObjects0, arrObjects1, intFilter, arrEvents, arrEvent, strClash1, strClash2

	intFilter = rhSurface + rhPolysrf + rhMesh + rhExtrusion

	'arrObjects0 = Rhino.GetObjects("Select first set for clash detection", 0)
	arrObjects0 = Rhino.GetObjects("Select first set for clash detection", intFilter)

	'arrObjects1 = Rhino.GetObjects("Select second set for clash detection", 0)
	arrObjects1 = Rhino.GetObjects("Select second set for clash detection", intFilter)

	arrEvents = Rhino.ObjectClash(arrObjects0, arrObjects1, 0.25)

	If IsArray(arrEvents) Then

		For Each arrEvent In arrEvents

			Call Rhino.AddPoints(arrEvent(2))
			strClash1 = arrEvent(0)
			strClash2 = arrEvent(1)
			'Rhino.MessageBox "Clash found between " & Rhino.ObjectName(strClash1) & " and " & Rhino.ObjectName(strClash2)
			Rhino.Print "Clash found between " & Rhino.ObjectName(strClash1) & " and " & Rhino.ObjectName(strClash2)

		Next
	Else
		Rhino.MessageBox "A problem occurred with the clash array, most likely you've selected and object type that the script doesn't like (ie closed solid polysurface)"

	End If 
End Sub

Hi @JoshLobel,

I see this - thanks for reporting.

https://mcneel.myjetbrains.com/youtrack/issue/RH-54132

– Dale

@dale not to compound the issue, but would it also be possible to allow for a negative clearance, meaning an acceptable amount of overlap between geometry? I can submit this as a separate request if that would be better. Thanks, Josh

Hi @JoshLobel,

I’ve added your wish to the pile.

https://mcneel.myjetbrains.com/youtrack/issue/RH-54182

– Dale

@JoshLobel -

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

Scott - so far so good! Thanks to the team for adding this feature.

Ran a few tests using the GH component:

  1. Clashing a single object against 1000 other objects (representing screws) which ran quickly and looks to have found all the clashes.
  2. Clashed the set of 1000 objects against itself (removing all the self-self clashes) which also ran well and looks to have found all clashes.
  3. Clashed a set of 1456 objects against a set of 488 objects. This ran a bit slower, but still in under 10 seconds which is fine, and again it looks to have found all clashes.

Haven’t tried it using RhinoInside yet, but looks like we’re going to have some upcoming work where we can put this to good use, so I’ll keep you posted. The only additional functionality we’d be looking for right now is the ability to set a negative clearance - meaning that we know there may be some minor overlap between parts that we want to ignore in our clash testing. Is that possible?

Thank you for giving the feature a try.

At this point we do not have the negative clash. At this point the clash only tries to find some level of clash, it does not analyze the amount of clash. I will talk to some of our people and see what is possible.

This is what I was messing with in Revit. This definition makes a CSV clash report: