cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Create a 3D Label widget from script

Laurenz
10-Marble

Create a 3D Label widget from script

I would like to parse some JSON and then create 3D Labels at runtime via script. Is it possible to create widgets from script?
What i found so far is the Home.json which stores all elements in the scene, and it seems Icould be able to add objects by writing to this file, but this honestly feels a little rough and i also doubt that that will work at runtime.
1 REPLY 1

I don't believe there is any way to create widgets at run. A solution and what i do it to just change the content (text or image src) via JS as needed. So for example i have localization of my experiences and i load a JSON object with all the things i want to change for each language. Some are images with local language text on them others are raw text for things like buttons and toggles. Then when you pick a language i just blast thru the section of this object with the chosen language key and feed it all into a $scope.setWidgetProp function.

 

With the exception of the problem you have found about 3D images not accepting new widths (and also not recalculating 'auto' widths) this works well.

Announcements

Top Tags