running this script from "run script" don't work...
Hi,
I made a little script to project an object on a surface keeping its volume
when I drag and drop the script to max it works fine, when I run from menu "run script" it don't work as it should.
anybody can help ? thanks
How to use :
- select an edit poly object, select all its vertices to be projected
- drag and drop the script to max
- pick a vertex of the selected object which will be in contact with the surface
- clic the button and choose a target surface
---------------------------------------------------------
(
savesnap=snapMode.active
snapMode.active=true
ptax = pickpoint snap:#3d
vvv = $
rollout pick_box_test "Target surface"
(
pickbutton chooseit "Project on me" width:140
on chooseit picked obj do
(
undo on(
for v in polyOp.getVertSelection vvv do
(
pta = (polyOp.getVert vvv v)
RRay = ray pta [0,0,-1]
aaa = (intersectRay obj RRay)
if aaa != undefined then
(
PPos = (intersectRay obj RRay).pos
PPosPRO = [ PPos.x , PPos.y , (PPos.z + pta.z - ( ptax.z)) ]
polyOp.setVert vvv v PPosPRO
)
else
(
RRay = ray pta [0,0,1]
aaa = (intersectRay obj RRay)
if aaa !=undefined then
(
PPos = (intersectRay obj RRay).pos
PPosPRO = [ PPos.x , PPos.y , (PPos.z + pta.z - ( ptax.z)) ]
polyOp.setVert vvv v PPosPRO
)
)---end else
)--- end for
)--- end undo on
snapMode.active=savesnap
)--- end on choseit
)--- end rollout
createDialog pick_box_test
)
-------------------------------------------------------
Comments
...
What if you not have selected object or more then one selected objects.
Your concept is not good. Better create two pickbuttons : one for source and second for target object. Anyway ... this is fixed your first code
bga