Scripting issue with Screen coordinates and dialog

Good afternoon Everyone!

was hoping someone can shed a light on the problem i am facing.


basically, i am architectural viz, and wanted to make a simple script that..

-when i run the script (via binding key to the macroscript), it moves the selected object "to the right", as in not in X or Y or Z but upwards depending on the view i am at.  basically even if i am on top view, or right view, when i execute the script i want to move it to the right of the screen by given dimension.

I thought it would be relatively simple, using "screen coordinates", where i can just tell the max to move the object XXXmm to x axis on screen coordinates.

in simple script form..

-  in coordsys screen move $ [xxx,0,0].

however, what seems to happen is that it moves in weird direction. like in top view,it will move to the right, and on front view also, but on the left/right view, it will be moving up or down (feels random)


I was wondering if this is a bug or i am just not getting the script right.

in summary, basically i just want a script that can move a selected object to the right by given dimension in orthogonal view. (like when you have your max coordinate on screen, type in xxxmm on offset:screen adn press enter).



also, second issue i am facing is that when i create a dialog, to catch some input, and destroydialog(), the keyboard shortcutes does not function, so i can't call up consecutive macroscript or input any keyboard shortcutes.

not sure if it is my script issue, or thats how maxscript functions, 


basically to overcome it, i have to run the script (my script has auto destroydialog at the end) then click on the viewport, then input any keyboard shortcuts.


Will appreciate greatly if someone can help me out : )


Thank you so much in advance!


Comment viewing options

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

use it like this :

just use (screenTM = inverse(getViewTM())) instead of (screen)
and use ( instead of (selection) to get the right pivot.
(in coordsys screenTM about ( .......)

Maarten's picture

Did you figure out what the issue was?

Hi, I am running into a similar problem where I am trying to measure an object's max and minimum x values in a specified coordinate system but I am getting unexpected values from it for reasons unknown to me. I was wondering if you managed to figure out what theproblem was (objects moving in unexpected directions depending on what view you are currently in with your script)?
Thank you,

Comment viewing options

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