fn myfnAttach sObj sPolys =
(
	for i=1 to sPolys.count do
	(
		f = (sPolys[i].index)
		p = point ()
		p.size = 5
		att = attachment ()		
		p.pos.controller = att
		att.node = sObj
		addNewKey att 0f
		key = AttachCtrl.getKey att 1
		key.face = (f-1)
		
		format "Attach % to face %\n" (p.name) (f)
	)
)
-------------------------------------------------------------------------



if selection != undefined do
(
	if (classof(selection[1]) == Editable_mesh) do
	(
		myfnAttach selection[1] (selection[1].selectedFaces)
	)
)