help with script to save and restore views

Hi guys, how´s going?
i need a help with a script i have, wich i "wrote" using macro recorder (i´m not a coder). Basically the script has two buttons, one saves the current view and the other restores the saved view. The thing is that it does not recognize if the view is a perspective or orthographic, so sometimes it gives an error if the saved is not the same type as the actual view (example, when i try to restore a saved perspective in an ortho view).
So, is there a way to "typify" (i don´t know if this word exists) the saved view, so the script does the restoration correctly, without errors? can anyone help with that?
Below the script that i´m using:

(
-- Define the dialog with two buttons
rollout Bttn_view "Bttn_view" width:100 height:60
(
button button1 "Save-view"
button button2 "Restore-view"

-- Define button 1 click event handler
on button1 pressed do
(
actionMan.executeAction 0 "40227" -- Views: Save Active View
)

-- Define button 2 click event handler
on button2 pressed do
(
actionMan.executeAction 0 "40228" -- restore saved view
)
)

-- Create an instance of the dialog
createDialog Bttn_view
)

Thanks in advance,

Jsrocha

Comments

Comment viewing options

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

Hi miauu, actually i use the

Hi miauu,
actually i use the script you mentioned, but i need a more agile script. This one is good, i use it a lot, but for some tasks i need something faster.
Thanks for your suggestion ;-)
Cheers,

Jsrocha

Comment viewing options

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