ScriptSpot

Forum topic · Scripts Wanted

create a box on every face normal center from selected object

By Ulrich Thümmler · 2025-01-28

Description

Hi,

i need a script that create a box, teapot whatever on every face center with normal align from selected object.

regrads,
Ulrich

Attachments
Comments (1)

.

miauu · 2025-02-18

This can be achieved in different ways. This is one of them:


(
	objToCreate = Teapot()
	
	delSurfaceObj = false
	surfaceObj = selection[1]
	if classOf surfaceObj != Editable_Poly do
	(
		surfaceObj = convertToPoly (copy surfaceObj)	
		delSurfaceObj = true
	)
	facesCnt = polyop.getNumFaces surfaceObj	
	for f = 1 to facesCnt do
	(
		obj = instance objToCreate
		obj.pos = polyop.getSafeFaceCenter surfaceObj f
		obj.dir = polyop.getFaceNormal surfaceObj f
	)	
	delete objToCreate
	if delSurfaceObj == true do delete surfaceObj
)