ScriptSpot

Forum topic · General Scripting

knowing selection of an -element sub-object level- vertices count

By ele · 2017-01-01

Description

hallo,

i'm very new to scripting and currently i had to subdivide a very big mesh by element that have a maximum number of vertices of a uint (65536) value.

but when i select part of the elements i can get only the number of faces selected.

how i could achieve this?

currently i select the subobjectlevel 5 (element) for a mesh

with $.basemesh.mesh. i access the mesh, but how i get the element sub-selection (the selected part of the selected mesh)?

thank you for your time and have a good year.

Comments (2)

ele · 2017-01-04

thank you for your script, miauu, it works very well

cheers!

.

miauu · 2017-01-03

The code below will works only with Editable POly or editable Mesh objects. You must be in Element sub-object level and you must have several polygons selected.


(
	curO = selection[1]
	if classOf curO == Editable_Poly then
	(
		if subobjectlevel == 5 do
		(
			--	"get selected polygons"
			selPolysBA = polyop.getFaceSelection curO
			--	"get the verts that belongs to the selected polygons"
			vertsBA = polyop.getVertsUsingFace curO selPolysBA
			--	"print in the MaxScript Listener the count of the vertices"
			format "Verts count: % \n" vertsBA.numberset
		)
	)
	else
	(
		if classOf curO == Editable_Mesh then
		(
			if subobjectlevel == 5 do
			(
				--	"get selected polygons"
				selPolysBA = getFaceSelection curO
				--	"get the verts that belongs to the selected polygons"
				vertsBA = meshop.getVertsUsingFace curO selPolysBA
				--	"print in the MaxScript Listener the count of the vertices"
				format "Verts count: % \n" vertsBA.numberset
			)
		)
	)
)