ScriptSpot

Forum topic · General Scripting

Get z-axis value of selection

By remykonings · 2019-01-20

Description

Hello,

So i'm struggling a bit with getting the value of the z-axis from a selected object and placing that in a text-edit field (a spinner in this case).

The idea is that i use the "Copy Height" button, to get the z-axis value and placing that in the spinner text-edit field.

try (destroyDialog test) catch()

Rollout test "Move"
(
button upDown "Move" tooltip:"Move the selected object" width:90 across:3
spinner amount "" type:#integer range:[-10000,10000,300] width:80 align:#center
button copyHeight "Copy Height" tooltip:"Copy the height of a selected object:" width:90

on upDown pressed do
move $ [0,0,amount.value]
)
createDialog test width:300

Comments (2)

barigazy · 2019-01-21

 
on copyHeight pressed do 
(
    if selection.count == 1 do amount.value = selection[1].pos.z
)

*

remykonings · 2019-01-23

Thank you for your reply.

Therefore i have a follow up question regarding the use of it:
Attached there is a script which i'm building (focus is on rollout "aankleding")

Position Z from your code. I like to use that value in the spinner on the left when copyHeight is pressed. But at default, i still like the default spinner value to be 300.

Is this possible?

Thank you :)

Attachments