PDA

View Full Version : moving vertices, need help


SamSed
02-10-2005, 01:45 PM
hi, to resume the probleme :

i create a script to draw a box and spherify it ( very easy , yah :D ) , 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 :sad:
thank you

prettyPixel
02-10-2005, 04:47 PM
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

SamSed
02-10-2005, 07:28 PM
Thanks man :) , i'll try it when i get home

SamSed
02-11-2005, 05:27 AM
thanx prettyPixel for your help , i used this one


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]


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 ??
:sad: :sad:

prettyPixel
02-11-2005, 11:17 AM
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
)
)

SamSed
02-14-2005, 12:35 AM
Thanks PrettyPixel its working:applause:

CGTalk Moderation
02-14-2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.