Community
Showcase Forum
Welcome to Autodesk’s Showcase Forums. Share your knowledge, ask questions, and explore popular Showcase topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compare two scenes side by side through a internet interface

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
Anonymous
926 Views, 14 Replies

Compare two scenes side by side through a internet interface

As the title suggests,

I would like to compare two scenes of different projects in the same window of SC through the internet interface (accessible from localhost: 5555);
this is possible on the SC program, through menu "Present / Compare Scenes", then click "Add Scene" and finally "Present / Side by Side."
At present I can do 2 of 3 phases:
1 - Compare scenes: with the function COMPARISON_UI_SET_MODE :: 1 (true) or 0 (false)
2 - Add Scene: with the STAGE_OPEN :: path of the project

 

the 3 I just can not do it.
Looking at the SC console, I see that the click on "Side by Side" in the program correspond to these messages on the console:

console.jpg

 

(which is marked in red is the name of the project)

 

on WebRoot/index.html i used:

 

a) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{Left:{}}||STAGE_ACTIVE_LIST::{Right:{Project-Completo.zip},Left:{}},');">Prova 14</a>

 

b) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<Left,Left: >}||STAGE_ACTIVE_LIST::{<Right,Right: Project-Completo.zip>,<Left,Left: >},');">Prova 13</a>

 

c) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<\'Left\',\'\'}||STAGE_ACTIVE_LIST::{<\'Right\',\'Project-Completo.zip\'>,<\'Left\',\'\'>},');">Prova 12</a>

 

d)<a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<Right,C:/TMP/Project-Completo.zip>,<Left, >}');">Prova 11</a>

 

e) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{Right,Left},{C:/TMP/Project-Completo.zip,}');">Prova 10</a>

 

and other attempts at changing the syntax, SC I always returns the message:

erroreSC.jpg

 

then the problem should be on the syntax which I use the dictionary, can anyone help?

14 REPLIES 14
Message 2 of 15
cikho
in reply to: Anonymous

i took time to investigate a bit more, here is what i've found out

 

load a stage:

<li><A href="#" onclick="send_request('STAGE_OPEN::C:\\andrea\\testing\\compare\\test3.a3s');">open</a></li>

 set side by side comparison mode (actually splits the screen in 2 viewport):

<li><A href="#" onclick="send_request('VIEWER_SET_LAYOUT::2::SideBySide');">TEST SIDESIDE</a></li>

 change the position of files in viewports:

should be the STAGE_SET_ACTIVE code and not the STAGE_ACTIVE_LIST, but i can't figure out the correct syntax for the dictionary (dict) parameter set 😐

 

also for this one, you should use the scene ID given when the scene is loaded and not the full file path

_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 3 of 15
Anonymous
in reply to: cikho

Yes!!!!!!!!

it works perfectly!
cikho thank you very much! you are great! Smiley Very Happy

Message 4 of 15
cikho
in reply to: Anonymous

eh eh prego (you're welcome)
did you find out the dict syntax or it works good as is?
_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 5 of 15
Anonymous
in reply to: cikho

it works good as is,

I haven't tried the dict syntax because it does what I need already.

Do you know if there is an opposite function to STAGE_OPEN?
(I read all the message reference but some have escaped me as the VIEWER_SET_LAYOUT Smiley LOL)

Message 6 of 15
cikho
in reply to: Anonymous

are you using the online sdk help?
contains a lot of informations 🙂

VIEWER_SET_LAYOUT can use also the parameters ::1::Single to reset the viewport to single and it will use the scene marked as left.

to actually close a scene i think it's quite complicated..
the only command i know is APPLICATION_CLOSE_SCENE, but if i'm not wrong it will close the whole scene not only one of the stages of the comparison mode..

try to test it, but imho it won't work.
_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 7 of 15
Anonymous
in reply to: cikho


@cikho wrote:
are you using the online sdk help?
contains a lot of informations 🙂

yes, I'm using it.


VIEWER_SET_LAYOUT can use also the parameters ::1::Single to reset the viewport to single and it will use the scene marked as left.

I did this already, I intended the possibility of closing one of the two scenes in sidebyside mode and then disable with Viewer_set_layout.


to actually close a scene i think it's quite complicated..
the only command i know is APPLICATION_CLOSE_SCENE, but if i'm not wrong it will close the whole scene not only one of the stages of the comparison mode..

try to test it, but imho it won't work.

 I had already tried this, it close the whole scene, I keep looking. Thanks.

Message 8 of 15
Anonymous
in reply to: Anonymous

I could not to do what I wanted,
also happens that after I open a new scene with STAGE_OPEN
and then enable the dual display with VIEWER_SET_LAYOUT::2::SideBySide
if I come back with VIEWER_SET_LAYOUT::1::Single
the scene that remains active is the second to be opened, while I would like to remain active the first scene, how can I do?

the same behavior also happens if I do this directly from SC

Message 9 of 15
cikho
in reply to: Anonymous

this is why we need to understand the proper syntax of thedict in the STAGE_SET_ACTIVE command..
this one should state what scene is active in the stated wiewport (left or right).. and should enable you to change it..

the stage that remains is always the one assigned to your Left viewport (or at least it worked for me)
_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 10 of 15
Anonymous
in reply to: cikho

documentation says that STAGE_ACTIVE_LIST requires a parameter:

 

  • viewportIdTostageId - A dictionary with the ID of the viewport as the key and the ID of the stage that will become active in that view as the value. (To get the viewport ID, create a custom script that listens to the VIEWPORT_LAYOUT message. To get the stage ID, listen to STAGE_ messages.)

 

the VIEWPORT_LAYOUT does not seem to exist anywhere but.


.. To get the stage ID, listen to STAGE_ messages ..

none of the STAGE_ messages seems to do this

Message 11 of 15
cikho
in reply to: Anonymous

STAGE_ACTIVE_LIST and STAGE_SET_ACTIVE share the same description and parameters:
a dictionary (or a list) stating what stage goes in what viewport.

i totally agree that the VIEWPORT_LAYOUT message seems to not exists.
my perception is that SATGE_SET_ACTIVE does a request of changing the viewport configuration, while the STAGE_ACTIVE_LIST just displays the current viewport configuration. this is why STAGE_ACTIVE_LIST shows up every time a change is made, is basically the showcase's response to a change in the viewport layout.

my idea is that when we will find the proper dict syntax, you should broadcast the STAGE_SET_ACTIVE and showcase responds displaying the STAGE_ACTIVE_LIST in the console as a confirmation.

_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 12 of 15
Anonymous
in reply to: cikho

I think so too,

infact trying some of the many tests that I did with STAGE_ACTIVE_LIST with STAGE_SET_ACTIVE return the same error on the dict:  Smiley Sad

 

erroreSC.jpg

 

(with STAGE_ACTIVE_LIST instead of STAGE_ACTIVE_LIST)

Message 13 of 15
cikho
in reply to: Anonymous

yep i made a lot of tests too, in my opinion it's problematic to understand how exactly the HTML command statement is converted into phyton language and then broadcasted.
i try to explain my self:
in the html sentence, most of the time :: splits the command from the parameter or a first parameter from a second one. meanwhile the || always marks the end of a command and the start of a brand new one.

|| it is used, for example, when you have to send a sequence of command one after the other.

also, the broadcasted commands are always kept inside a ' ' sepration ( eg 'VIEWER_SET_LAYOUT::2:: SideBySide' ).

in phyton, the dict should be with one of theese syntaxes:

 

>>> a = dict(one=1, two=2, three=3)
>>> b = {'one': 1, 'two': 2, 'three': 3}
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
>>> d = dict([('two', 2), ('one', 1), ('three', 3)])
>>> e = dict({'three': 3, 'one': 1, 'two': 2})

 due to the html syntax, b,c,d and e cannot be used because of the presence of the' , that  potentially ends the send_request command.

i've tryed several times the syntax a, but it does not seem to work, maybe you'll have a better luck.

 

i seems to have understand that you're italian (ninja SCconsole file adress spying 😄 ) , so if you prefer an italian explanation just PM me 🙂

_________________________________________________________

almost a showcase PRO user 😛

if you find my post useful, please give kudos or mark as solution 😄
Message 14 of 15
Anonymous
in reply to: cikho

I try them! 

P.S.: to use the character ' you have to use \' instead

Message 15 of 15
Anonymous
in reply to: Anonymous

I could find the VIEWER_LAYOUT (which however is different from VIEWPORT_LAYOUT specified in the documents STAGE_SET_ACTIVE)
which has as this description:

 

VIEWER_LAYOUT (information application)
Internal message. Indicates how many viewports the viewer is split into, and a mask that controls the drawing in that viewport. For instance, when the viewer is split in half with a left viewport and a right viewport, this information will be sent in the format: ( (viewportName, 1), (viewportName, 2) ) This message is broadcastable.
Parameters:

viewportNameAndMask (tuple)

A tuple of (<viewportName>, <visibility mask>) pairs.

 

assuming that this can be of help (I doubt it, being an internal message I do not know if I can use it), there is the fact of seeing where and what to put in this custom script

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report