Edit Poly vertex Collapse with Scale (Scale vertices). Thanx Miauu

How to make as well as in this video for script?

http://youtu.be/YTGKr-CvNyQ

scale $.selectedVerts [0,0,0] does not work :(

Comments

Comment viewing options

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

Just cool!

I'm happy :) Thanx

Nik's picture

A HUGE THANK YOU, GREAT MAN. THIS GORGEOUS

JUST WELL DONE Thank you for this work and spent time on me.

AttachmentSize
images.jpg 9.45 KB
miauu's picture

Send me the scene with the

Send me the scene with the teapot and I will find where the problem is.

I've also noticed that sometimes pressing the Collapse button in modify panel(executing the sctip code also) not collapse all verts(some of they stays in places).

Nik's picture

here please

file attached

AttachmentSize
teapot_with_edit_poly_ver._max_2010_.max 828 KB
miauu's picture

.

(
	curO = modPanel.getCurrentObject()
	if classof curO == Edit_Poly do
	(
		allVertsBA = curO.GetSelection #Vertex
		if allVertsBA.numberset != 0 do
		(
			centerPos = [0,0,0]
			for v in allVertsBA do 
			(
				vPos = curO.getVertex v
				centerPos.x += vPos.x
				centerPos.y += vPos.y
				centerPos.z += vPos.z
			)
			centerPos /= allVertsBA.numberset
 
			curO.SetOperation #Transform
			curO.ScaleSelection  [1e-005,1e-005,1e-005] parent:(transMatrix centerPos) axis:(transMatrix centerPos)
			curO.Commit ()
		)
	)
	if classof curO == Editable_Poly do
	(
		local poGetVert = polyop.getVert
		local poSetVert = polyop.setVert
		allVertsBA = polyop.getVertSelection curO
		if allVertsBA.numberset != 0 do
		(
			centerPos = [0,0,0]
			for v in allVertsBA do 
			(
				vPos = poGetVert curO v
				centerPos.x += vPos.x
				centerPos.y += vPos.y
				centerPos.z += vPos.z
			)
			centerPos /= allVertsBA.numberset
			for v in allVertsBA do
			(
				poSetVert curO v centerPos
			)
		)
	)
)
miauu's picture

...

With Edit Poly modifier:

$.modifiers[1].ButtonOp #CollapseVertex
$.modifiers[1].Commit()

Or if you wants to do it with the scale:

(
	allVertsBA = $.modifiers[#Edit_Poly].GetSelection #Vertex
	centerPos = [0,0,0]
	for v in allVertsBA do 
	(
		vPos = $.modifiers[#Edit_Poly].getVertex v node:$
		centerPos.x += vPos.x
		centerPos.y += vPos.y
		centerPos.z += vPos.z
	)
	centerPos /= allVertsBA.numberset
 
	$.modifiers[#Edit_Poly].SetOperation #Transform
	$.modifiers[#Edit_Poly].ScaleSelection  [1e-005,1e-005,1e-005] parent:(transMatrix centerPos) axis:(transMatrix centerPos)
	$.modifiers[#Edit_Poly].Commit ()
)

What you mean by attached object?

Nik's picture

Sorry does not work

with scale:

-- Unknown property: "modifiers" in $selection

Moreover, when try to repeat the code obtained from MAXscript Listener, all turns out the same way.

And

$.modifiers[1].ButtonOp #CollapseVertex
$.modifiers[1].Commit()

not working properly too.

AttachmentSize
error.gif 102.49 KB
Nik's picture

Oo, thanx miauu but...

But I realized that I had to do it this way

http://youtu.be/l8-1XuedY7A

For me this for the time being difficult. Please help
And even to the same how this will be with attached objects.

Thanx for response.

miauu's picture

.

Try this:

polyop.collapseVerts $ (polyop.getVertSelection $)

Works only with editable poly objects

Comment viewing options

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