Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5823

ObjectClash only working for extrusions

$
0
0

@JoshLobel wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5823

Trending Articles