Skip to main content
15-Moonstone
January 5, 2022
Solved

Metadata JSON navigation

  • January 5, 2022
  • 2 replies
  • 1437 views

I want to navigate the metadata JSON file as I do with regular JSON files like the example below

 

myjson["/0/1/0"]["InnerField1"]["DetailExample"]

 

but I want to do this with metadata Vuforia API. How to? 

Many thanks

Best answer by pandersson

You can find descriptions in the help pages http://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2Fcad_metadata_api.html

 

2 replies

14-Alexandrite
January 5, 2022
16-Pearl
January 5, 2022

Once you have executed say for example PTC.Metadata.fromId  as shown below you can use just like standard json but the functions provided in the link by @pandersson might be easier 

 

$scope.$on('userpick', function (event, targetName, targetType, eventData) {

var pathid = JSON.parse(eventData).occurrence;

try {
PTC.Metadata.fromId(targetName).then((metadata) => {

var displayName = metadata.get(pathid, 'Display Name');

CURRENT_OCCURANCE = pathid;

resetHighlight();
var itemArray = [];
itemArray.push(targetName+'-'+pathid);
SELECTED_ITEMS.push(targetName + '-' + pathid);

//hilite(itemArray,true);
setColor(itemArray, HIGHLIGHT_COLOR);

doPopup(displayName, pathid);

});

} catch (err) {

console.log(err);
}

});

 

sgreywilson_0-1641389536118.png