ScriptSpot

Forum topic · General Scripting

bounding box information

By dgu · 2012-10-15

Description

Dear Team

I just started with scripting and i am wondering how to get all bounding box of all object in a scene and the material id or Object Id.

may i have a pointer of research for a newbie ???

thanks alot

dgu

Comments (2)

ObjInfo function

barigazy · 2012-10-15

try this function. Supports only e-poly and e-mesh objects.

fn getObjInfo =
(
clearListener()
local classArr = #(Editable_Mesh, Editable_Poly, PolyMeshObject)
local PolyMtlID = polyop.getFaceMatID, MeshMtlID = getFaceMatID
for o in geometry where (idx = findItem classArr (classOf o)) != 0 do
(
local supported = true, facesCount = o.faces.count, idArr = #()
for i = 1 to facesCount do
(
idNum = if idx == 1 then MeshMtlID o i else PolyMtlID o i
if finditem idArr idNum == 0 do append idArr idNum
)
sort idArr
format "Object: % ; bBox:% ; ObjID: % ; MtlID's: % \n" o.name (nodeLocalBoundingBox o) (o.gbufferchannel) idArr
)
)
getObjInfo()

dgu · 2012-10-16

thanks alot , that is very helpfull

david