MoI discussion forum
MoI discussion forum

Full Version: Getting camera view and restore it

Show messages: All  1-7  8-12

From: Samba Oleg (SAMBA_OLEG)
9 May 2019   [#8] In reply to [#7]
Thanks again for this hint!

This will speed it up a lot. I have so many different view in my documentation.

Is there any change to automate the process of converting the given coordinates into a reusable format without changing comma to dots and spaces?


Result of the 1st script:

Camera=407,04,-682,82,-230,78
Target=62,01,-44,72,-21,64

Needed Values for the dialog box:

407.04 -682.82 -230.78
62.01 -44.72 -21.64

Samba
From: Michael Gibson
9 May 2019   [#9] In reply to [#8]
Hi Samba, do the different fields in the dialog not use commas for the decimal separator when you first open it? It is supposed to if your operating system language settings have that set.

Does this work where the numbers are separated by spaces? :

script: function str(pt) { return moi.ui.formatCoordinate(pt.x,2) + ' ' + moi.ui.formatCoordinate(pt.y,2) + ' ' + moi.ui.formatCoordinate(pt.z,2); } var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); moi.copyTextToClipboard( 'Camera=' + str(v.cameraPt) + '\r\nTarget=' + str(v.targetPt) );

Let me know if that still isn't quite right.

- Michael
From: Samba Oleg (SAMBA_OLEG)
10 May 2019   [#10] In reply to [#9]
Hi Michael,

I always get the commas as the decimal separator. This is the return of the last script:

Camera=10,24 -20,48 10,24
Target=0 0 0

My system is set to German.

Samba
From: Michael Gibson
10 May 2019   [#11] In reply to [#10]
Hi Samba, and that doesn't work to put in those comma decimal separator values in the dialog?

Here's another version that should make period decimal separators:

script: function str(pt) { return moi.ui.formatCoordinate(pt.x,2).replace(',', '.') + ' ' + moi.ui.formatCoordinate(pt.y,2).replace(',', '.') + ' ' + moi.ui.formatCoordinate(pt.z,2).replace(',', '.'); } var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); moi.copyTextToClipboard( 'Camera=' + str(v.cameraPt) + '\r\nTarget=' + str(v.targetPt) );

- Michael
From: Samba Oleg (SAMBA_OLEG)
10 May 2019   [#12] In reply to [#11]
Hi Michael,


it's a bit funny. The extended view angle dialog shows the camera and target position with commas on my system, but it only accepts the coordinates with a period decimal separator.

So, the last script solved the problem for me.

Thank you very much for spending so much time.


Samba

Show messages: All  1-7  8-12