need help please...

Hello
I need a script to move up selected polys with step(to make stairs)
Best should be to move selected elements with a UI to give the value... (stairs can have multiples polys)
Sorry, but I need this, and I can't do it myself, if somebody can help ? :-) Thanks

Comments

Comment viewing options

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

BitArray.NumberSet

Hi Titane,
shortly getFaceSelection() return BitArray.
I think this example will explain what you need:

b = ConvertTo (Box()) Editable_Poly
polyop.setFaceSelection b #(2) -- select 'top' face
fSel = polyop.getFaceSelection b -- #{2}
fSel.count -- 6
classOf fSel -- BitArray
fSel.numberSet -- 1

Cheers!

my recent MAXScripts RSS (archive here)

titane357's picture

Hello ! Perhaps not very

Hello !
Perhaps not very elegant, but it works... I don't know how to use bitarray, so I convert to array...

Thanks ! :-)

-----
h=0
poly = selection[1]
fSel = polyop.getFaceSelection poly
classOf fSel -- BitArray
fSelA = fSel as array
for a=1 to fSel.numberSet do
(
h+=10
print fSel.numberSet
vList = polyop.getVertsUsingFace poly fSelA[a]
polyop.moveVert poly vList [0,0,h]
)
update poly
---

Anubis's picture

so, the job done :)

Working with BitArrays is more faster than Arrays,
but use what you like and found as easy ;)

h = 0 ; poly = selection[1]
fSel = polyop.getFaceSelection poly
for bit in fSel do
(
	h+=10
	vList = polyop.getVertsUsingFace poly bit
	polyop.moveVert poly vList [0,0,h]
)
update poly

my recent MAXScripts RSS (archive here)

titane357's picture

problem is : the selection

problem is : the selection order is not conserved....

Anubis's picture

Example

-- move/offset selected faces +3 by Z
poly = selection[1]
if isKindOf $ Editable_Poly do
(
	fSel = polyop.getFaceSelection poly
	vList = polyop.getVertsUsingFace poly fSel
	polyop.moveVert poly vList [0,0,3]
	update poly
)

Cheers!

my recent MAXScripts RSS (archive here)

titane357's picture

Hello Anubis ! Thanks for

Hello Anubis !
Thanks for help but I don't understand something.
I need to make a loop to move up each face with an incremental value.
Can I tape : "fSel.count" ? because fSel.count give me total faces, not just selected faces.
I know that I'm a poor scripter but I don't understand what is wrong with the following...

h=0
poly = selection[1]
fSel = polyop.getFaceSelection poly
for a=1 to fSel.count do
(
h+=1
vList = polyop.getVertsUsingFace poly fSel[a]
polyop.moveVert poly vList [0,0,h]
)
update poly

Comment viewing options

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