[Closed] moving vertices, need help
hi, to resume the probleme :
i create a script to draw a box and spherify it ( very easy , yah ) , well i need a code that converts my object into an editpoly then move some vertices ex: move vertex ‘1’ to xyz(x0,y0,z0) . and then a code to quit the editpoly.
i’m learning some basic code scripting , but this one is quiet difficult for me , help guys 🙁
thank you
i hope that this will help you :
obj=box length:100.0 width:100.0 height:100.0 lengthsegs:10 widthsegs:10 heightsegs:10 pos:[0,0,0]
convertToPoly obj
polyOp.moveVert obj #{1} [-10,-10,-10]
– or
coord=polyOp.getVert obj 1
coord.x+=-10; coord.y+=-10; coord.z+=-10
polyop.setVert obj 1 coord
– if you want to move several vertices convert your array to a bitarray:
myVerts=#(2,4,6)
polyOp.moveVert obj (myVerts as bitarray) [-10,-10,-10]
Good luck for your script
thanx prettyPixel for your help , i used this one
but it doesn’t work , i put my code
(
button btn_one "Generate" \
tooltip: "Blablablabla" \
pickbutton btn_two "Process" \
tooltip: "Blablablabla" \
enabled:false \
on btn_one pressed do
(
obj=box length:100.0 width:100.0 height:100.0 lengthsegs:3 widthsegs:3
heightsegs:3 pos:[0,0,0]
btn_two.enabled = true
btn_one.enabled = false
)
on btn_two pressed do
(
convertToPoly obj
polyOp.moveVert obj #{1} [-10,-10,-10]
btn_two.text = obj.name
btn_two.enabled = false
)
)
what did i missed ??
🙁 🙁
because the name of variable “obj” is not defined in btn_two structure, only in btn_one structure… the object is definitively created but not its name of variable
in structure “btn_two” obj=undefined
You can get back the object in this way
on btn_two picked obj do
(
if obj != undefined do
(
convertToPoly obj
polyOp.moveVert obj #{1} [-10,-10,-10]
btn_two.text = obj.name
btn_two.enabled = false
)
)