selecting objects that are in positive x axis

is there a way in maxscript that you can select objects whose vertices only have positive x values or 0? would like to make this selection with maxscript then apply a mirror script. then to toggle off the mirror i'd want to reselect objects that have vertices with -x values and delete them. Is this possible?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Here is two choise:
#1 select all geometry objects which have at least one verts in negative space.
(argument "axsis" may be "X","Y" or "Z")

fn collectObjsMinVerts objs axis: = if objs.count != 0 do
(
	objArr = #()
	for o in objs where canConvertTo o Editable_Mesh do
	(
		notFound = on
		for v = 1 to o.mesh.verts.count while notFound do 
		(
			if getProperty (o.mesh.verts[v].pos*o.transform) axis <= 0 do (append objArr o ; notFound = off)
		) ; notFound = on
	)
	select objArr
)
collectObjsMinVerts geometry axis:"x"

#2 select all geo-objects which have all verts in positive space.
(argument "axsis" may be "X","Y" or "Z")

fn collectObjsMaxVerts objs axis: = if objs.count != 0 do
(
	objArr = for o in objs where canConvertTo o Editable_Mesh collect o
	for i = objArr.count to 1 by -1 do
	(
		notFound = on
		for v = 1 to objArr[i].mesh.verts.count while notFound do 
		(
			if getProperty (objArr[i].mesh.verts[v].pos*objArr[i].transform) axis <= 0 do (deleteItem objArr i ; notFound = off)
		) ; notFound = on
	)
	select objArr
)
collectObjsMaxVerts geometry axis:"x"

barigazy

miauu's picture

.

You forgot that this

o.mesh

will create new copy of the mesh for every itteration.

barigazy's picture

...

Yes I know. Forgot to place it in var.
I left this to requester :)

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.