Get z-axis value of selection

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

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

barigazy

remykonings's picture

*

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 :)

AttachmentSize
workflow.ms 6.23 KB
workflow.png 13.36 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.