Hi,
I tried to make a script to change a plane size keeping its pivot at the same place.
Of course my script works just in one case, it don't take in account plane rotation, and is not interactive... yes I'm bad scripter.
If someone have time and is interrested, I'd so happy. Thanks a lot.
Forum topic · Scripts Wanted
Change selected plane size and keep pivot in place
By titane357 · 2020-12-10
Description
Comments (3)
.
miauu · 2020-12-10
(
obj = selection[1]
scaleX = 2
scaleY = 3
scaleZ = 1
in coordsys obj.transform
(
scale obj [scaleX, scaleY, scaleZ]
)
)
You will have to find proper values of scaleX and scaleY.
titane357 · 2020-12-11
Hi, thanks for answer.
But I wanted to keep plane as a plane object.
I tried this :
OBJ = selection[1]
MIDD = ( OBJ.max + OBJ.min ) /2
POS = OBJ.pos
DIST = distance MIDD POS
OLDL =OBJ.length
OLDW=OBJ.width
try destroyDialog rlslice catch()
global rlslice = rollout rlslice ""
(
spinner spL "LENGHT " width:90 range:[0.001,10000,OLDL] type:#float pos:[55,5]
spinner spW "WIDTH " width:90 range:[0.001,10000,OLDW] type:#float pos:[55,25]
button butconnect "GO" pos:[2,2]
on butconnect pressed do
(
OBJ.length = spL.value
OBJ.width = spW.value
OBJ.pos = [ OBJ.pos.x + ( OBJ.width- OLDW )/2 , OBJ.pos.y - ( OBJ.length - OLDL )/2 , OBJ.pos.z ]
OBJ.pivot = POS
)
)
createDialog rlslice 160 130
but it work just in some cases, ( with pivot at top left of the plane for eg ) I'm not only bad scripter but a noob in maths...
.
miauu · 2020-12-11
(
try destroyDialog rlslice catch()
global rlslice = rollout rlslice ""
(
spinner spL "LENGHT " width:130 range:[0.001,10000,10] type:#worldUnits pos:[5,5]
spinner spW "WIDTH " width:130 range:[0.001,10000,10] type:#worldUnits pos:[5,25]
on spL changed val do
(
if classof (curO = selection[1]) == Plane do
(
curO.length = val
)
)
on spW changed val do
(
if classof (curO = selection[1]) == Plane do
(
curO.width = val
)
)
on rlslice open do
(
if classof (curO = selection[1]) == Plane do
(
spL.value = curO.length
spW.value = curO.width
)
)
)
createDialog rlslice 160 130
)