<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;Dynamic&amp;quot; HTML Interface in VRED Forum</title>
    <link>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13040267#M254</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6639038"&gt;@andreasK3K4G&lt;/a&gt;&amp;nbsp;here is the link to the script mentioned to create a dynamic html from the scene content &lt;A href="https://github.com/simonnagel/VRED-autoGenerateHTMLOverlay" target="_blank"&gt;https://github.com/simonnagel/VRED-autoGenerateHTMLOverlay&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2024 05:35:34 GMT</pubDate>
    <dc:creator>seiferp</dc:creator>
    <dc:date>2024-09-24T05:35:34Z</dc:date>
    <item>
      <title>"Dynamic" HTML Interface</title>
      <link>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13030502#M252</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a project with a lot of data in it (3D and Excel)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I manage to extract and convert all the Excel information as metadata witch is in my opinion the best way to reuse or update them on the fly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I create basic functions that look inside my metadata to extract possibilities like :&lt;/P&gt;&lt;P&gt;Country gives access to specific version:&lt;/P&gt;&lt;P&gt;Version gives access to UI depending on selected country&lt;/P&gt;&lt;P&gt;UI gives access to function depending on country and version&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a POC I display the resulted lists in multiple front plate and it works great, but the text is not clickable to launch a variant set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I need to set a HTML interface and past these list as button.&lt;/P&gt;&lt;P&gt;I tried to use the interface creation that Simon Nigel create, but the problem is that the interface will be recreate every time a variable change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I create a static interface with all my possibilities, but I'm not able to send my list in it to show or hide button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to send info from VRED to a web interface in a Frontplate to show hide &amp;lt;li&amp;gt;tag in my HTML interface ?&lt;/P&gt;&lt;P&gt;I will probably need a java script function for that but the main problem for now is to get the information from VRED.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my HTML file :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset="UTF-8"&amp;gt;
&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;style&amp;gt;
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class="intLeft"&amp;gt;
    &amp;lt;div class="col Titre"&amp;gt;
        &amp;lt;h1&amp;gt;MY&amp;lt;br&amp;gt;CONFIGURATOR&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col Configurator"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
            &amp;lt;ul&amp;gt;
                &amp;lt;li class="dropdown"&amp;gt;
                    &amp;lt;a href="#" data-toggle="dropdown"&amp;gt;COUNTRIES&amp;lt;i class="icon-arrow"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
                    &amp;lt;ul class="dropdown-menu" id="Countries"&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="Country1" onclick="playVSetSimple(this.value)"&amp;gt;Country1&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="Country2" onclick="playVSetSimple(this.value)"&amp;gt;Country2&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="Country3" onclick="playVSetSimple(this.value)"&amp;gt;Country3&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="Country4" onclick="playVSetSimple(this.value)"&amp;gt;Country4&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="Country5" onclick="playVSetSimple(this.value)"&amp;gt;Country5&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                    &amp;lt;/ul&amp;gt;
                &amp;lt;/li&amp;gt;
                &amp;lt;li class="dropdown"&amp;gt;
                    &amp;lt;a href="#" data-toggle="dropdown"&amp;gt;VERSIONS&amp;lt;i class="icon-arrow"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
                    &amp;lt;ul class="dropdown-menu" id="Tranches"&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button tranche"  value="V1" onclick="playVSetSimple(this.value)"&amp;gt;V1&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button tranche"  value="V2" onclick="playVSetSimple(this.value)"&amp;gt;V2&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button tranche"  value="V3" onclick="playVSetSimple(this.value)"&amp;gt;V3&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button tranche"  value="V4" onclick="playVSetSimple(this.value)"&amp;gt;V4&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button tranche"  value="V5" onclick="playVSetSimple(this.value)"&amp;gt;V5&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                    &amp;lt;/ul&amp;gt;
                &amp;lt;/li&amp;gt;
                &amp;lt;li class="dropdown"&amp;gt;
                    &amp;lt;a href="#" data-toggle="dropdown"&amp;gt;UI&amp;lt;i class="icon-arrow"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
                    &amp;lt;ul class="dropdown-menu" id="Softwares"&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI1" onclick="playVSetSimple(this.value)"&amp;gt;UI1&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI2" onclick="playVSetSimple(this.value)"&amp;gt;UI2&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI3" onclick="playVSetSimple(this.value)"&amp;gt;UI3&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI4" onclick="playVSetSimple(this.value)"&amp;gt;UI4&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI5" onclick="playVSetSimple(this.value)"&amp;gt;UI5&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button software"  value="UI6" onclick="playVSetSimple(this.value)"&amp;gt;UI6&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                    &amp;lt;/ul&amp;gt;
                &amp;lt;/li&amp;gt;
                &amp;lt;li class="dropdown"&amp;gt;
                    &amp;lt;a href="#" data-toggle="dropdown"&amp;gt;FUNCTIONS&amp;lt;i class="icon-arrow"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
                    &amp;lt;ul class="dropdown-menu" id="Capabilities"&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F1" onclick="playVSetSimple(this.value)"&amp;gt;F1&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F2" onclick="playVSetSimple(this.value)"&amp;gt;F2&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F3" onclick="playVSetSimple(this.value)"&amp;gt;F3&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F4" onclick="playVSetSimple(this.value)"&amp;gt;F4&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F5" onclick="playVSetSimple(this.value)"&amp;gt;F5&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F6" onclick="playVSetSimple(this.value)"&amp;gt;F6&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F7" onclick="playVSetSimple(this.value)"&amp;gt;F7&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F8" onclick="playVSetSimple(this.value)"&amp;gt;F8&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F9" onclick="playVSetSimple(this.value)"&amp;gt;F9&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;&amp;lt;button class="button capability" value="F10" onclick="playVSetSimple(this.value)"&amp;gt;F10&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;
                    &amp;lt;/ul&amp;gt;
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script&amp;gt;
function playVSetSimple(vset){
    var vsetString = `selectVariantSet("${vset}")`;
    vred.executePython(vsetString);
};
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any solution or hint&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 11:01:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13030502#M252</guid>
      <dc:creator>g_juifKYXZC</dc:creator>
      <dc:date>2024-09-19T11:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: "Dynamic" HTML Interface</title>
      <link>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13038224#M253</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;dont know that Interface from Simon you mentioned, but i would suggest to create the HTML dynamicly, like your topic name. To build a static html and show hide buttons is not a good way todo it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my approach:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;def set_content(metadata):

    content= '&amp;lt;!DOCTYPE html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;List&amp;lt;/title&amp;gt;'
    content = content + '&amp;lt;script type="text/javascript"&amp;gt;function playVSetSimple(vset){vred.executePython(selectVariantSet("${vset}")); }&amp;lt;/script&amp;gt;'
    content = content + '&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;'

    content = content + '&amp;lt;div class="intLeft"&amp;gt;&amp;lt;div class="col Titre"&amp;gt;&amp;lt;h1&amp;gt;MY&amp;lt;br&amp;gt;CONFIGURATOR&amp;lt;/h1&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class="col Configurator"&amp;gt;&amp;lt;div class="container"&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li class="dropdown"&amp;gt;&amp;lt;a href="#" data-toggle="dropdown"&amp;gt;COUNTRIES&amp;lt;i class="icon-arrow"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;ul class="dropdown-menu" id="Countries"&amp;gt;'
    
    for key, value in metadata.items():
        print(key)
        print(value)
        if key == "Country":
            for country, data in value.items():
                
        
                content = content + '&amp;lt;li&amp;gt;&amp;lt;button class="button country"  value="' + str(country) + '" onclick="playVSetSimple('+ str(data) +');"&amp;gt;'+ str(country) +'&amp;lt;/button&amp;gt;&amp;lt;/li&amp;gt;'
                
    content = content + '&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;'
    
    content = content + '&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;'
    
    return(content)


## example metadata
metadata = {"Country": {"Germany": "vset_germany", "France": "vset_france", "Spain": "vset_spain"}}
my_content = set_content(metadata)


###### setup the frontplate
theRoot = vrSceneplateService.getRootNode()

# Create text front plates attached to windows sides
theNode = vrSceneplateService.createNode(theRoot, vrSceneplateTypes.Frontplate, "Plate")

# Cast it to a scene plate object
thePlate = vrdSceneplateNode(theNode)

# Set scene plate type
thePlate.setContentType(vrSceneplateTypes.Web)
thePlate.setSize(1)

# Set some properties from scene plate 
thePlate.setUrl(my_content)

#######&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the metadata create a dictonary with all your information. My Example&amp;nbsp; just with the Countries. Line 25.&lt;/P&gt;&lt;P&gt;"def set_content"&lt;/P&gt;&lt;P&gt;will create the html with all information from your meta data.&lt;/P&gt;&lt;P&gt;From line 9 to 16, we will just add a button when there is a country in the metadata, and we provide the information stored in the metadata.&lt;/P&gt;&lt;P&gt;This String you can add to the Frontplate "thePlate.setUrl(my_content)".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, if you need to get a return value, from the vred documentation it says:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;// example how to call a Python command with a return value&lt;/SPAN&gt;
&lt;SPAN class=""&gt;vred&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;executePythonCommand&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;"getFov()"&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;function&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;value&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
  &lt;SPAN class=""&gt;{&lt;/SPAN&gt; &lt;SPAN class=""&gt;alert&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;value&lt;/SPAN&gt;&lt;SPAN class=""&gt;);&lt;/SPAN&gt; &lt;SPAN class=""&gt;}&lt;/SPAN&gt; &lt;SPAN class=""&gt;// do something with the value returned by getFov()&lt;/SPAN&gt;
&lt;SPAN class=""&gt;);&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 12:45:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13038224#M253</guid>
      <dc:creator>andreasK3K4G</dc:creator>
      <dc:date>2024-09-23T12:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: "Dynamic" HTML Interface</title>
      <link>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13040267#M254</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6639038"&gt;@andreasK3K4G&lt;/a&gt;&amp;nbsp;here is the link to the script mentioned to create a dynamic html from the scene content &lt;A href="https://github.com/simonnagel/VRED-autoGenerateHTMLOverlay" target="_blank"&gt;https://github.com/simonnagel/VRED-autoGenerateHTMLOverlay&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 05:35:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13040267#M254</guid>
      <dc:creator>seiferp</dc:creator>
      <dc:date>2024-09-24T05:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: "Dynamic" HTML Interface</title>
      <link>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13041351#M255</link>
      <description>&lt;P&gt;Hello Andreas,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You solution doesn't solve my problem because I cannot recreate the interface every time it have to be update.&lt;/P&gt;&lt;P&gt;As the CSS of my webpage display of hide list of &amp;lt;li&amp;gt; items in each dropdown menu, I will not be able to keep consistency on menu that are visible or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But you script help me a lot on the HTML creation.&lt;/P&gt;&lt;P&gt;As menu are based on my metadata, I can use your script to dynamically create the HTML interface on Scene opening or every time I add new metadata.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my side, I found a way to send my python list from my Variant set to my interface and display/hide elements in my lists according to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my Vset I have :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;mylist = ("element1","element2","element3"]
#add the ID to update as first element
mylist .insert(0,"IDToUpdate")
mylist_json = json.dumps(mylist)
we = vrWebEngineService.getWebEngine("Interface")
we.sendEvent("UpdateInterface", mylist_json )&lt;/LI-CODE&gt;&lt;P&gt;and in my java script I have :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;document.addEventListener("UpdateInterface", function(event) {
    const allAvailable = event.detail;
    const specificUl = document.getElementById(allAvailable[0]);
    const allListItems = specificUl.querySelectorAll('li');
    // Loop through each &amp;lt;li&amp;gt; element
    allListItems.forEach(function(listItem) {
        // Assuming the text content or some data attribute inside &amp;lt;li&amp;gt; is being compared to allAvailable
        const listItemContent = listItem.textContent.trim();
        listItem.style.display = 'list-item';
        // Hide the &amp;lt;li&amp;gt; if its content is not in the allAvailable list
        if (!allAvailable.includes(listItemContent)) {
            listItem.style.display = 'none';
        }
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 13:59:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/quot-dynamic-quot-html-interface/m-p/13041351#M255</guid>
      <dc:creator>g_juifKYXZC</dc:creator>
      <dc:date>2024-09-24T13:59:08Z</dc:date>
    </item>
  </channel>
</rss>

