Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
If I drag a wayfinder way point onto a part, it will give me the sbom id of that part as componentOccurence . How do I access that programmatically assuming it is the 1st waypoint? The helpcenter says the property is componentOccurence
https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FWidgetWaypoint.html%23
but none of these have worked:
$scope.view.wdg['wayfinder-1'].waypointsData[0].componentOccurence
$scope.view.wdg['wayfinder-1'].[0].componentOccurence
$scope.view.wdg['wayfinder-1'].componentOccurence
$scope.getWidgetProp("waypoint-1", "componentOccurence")
Secondly, if I can set componentOccurence programmatically, do I need to have x, y, and z data set to use the waypoint?
Solved! Go to Solution.
yes, I planed to provide the project but needed some checks to complete , Here attached the demo project "WayfinderTest-asmSearch-add3-Communty" the pictures in the previous post are from that project. The demo /test project I created in Vuforia Studio 9.24. Possibly it will not work in older version of Studio.
Please, let me know if you have questions. Thanks
Hi @JR_10569306 ,
I think yes, the property will not "know" the corrdinate (at least currently there is not such link between the ComponentOccurance /corrsponds to IDPath/ and coordinate ) in the mean time you could get that coordinate from the bounding box functionality -
So what currently works is that from ModelWidget Id and Componet Occurance will constuct a selection to highlight the component. That is really good pont where I did a pay attention. I have test project where I will search for model property and create a component list. Later I set that list as waitpoints.... I used some temporray highlighting of a selection but acctualy , possibly via the settings of the both proeprties will also work as standard I will check and will later let you know. Thanks
I checked it further:
- when the waypoint element is already created in UI it has the properties Component Occurrence - internal as "component-occurrence" and Model Widget ID internal as 'model' what in that case the UI will set when you add the waypoints via UI. Later you can get or set that properties on run time. My observation is that this has only infomrative meaning - so you can use it later to create an selection of the item. I could not see that it did some highliting on naivigating to waypoint but possibly I overlooked something.
Highlighting could be implemeted , no issue
But when you try to create the way points dynamicaly you can use the data , (not supported at all ) Such apprauch will work but it will ingorre the both properties occurance and modelWidget id. When I set it in the data and print the data later then it will omit the both properites.
in my test
$scope.app.waypointsElementAdd ({"x":(center.x+mod.x),"y":(center.y+mod.y),"z":(center.z+mod.z)},{"x":0,"y":0,"z":-1},{"x":0,"y":1,"z":0},0.2,0.3,
"WPN_"+(metadata.get(element, 'Display Name')).toString()+"-"+element.toString());
// versus setting of the both additional properties
$scope.app.waypointsElementAdd2 ({"x":(center.x+mod.x),"y":(center.y+mod.y),"z":(center.z+mod.z)},{"x":0,"y":0,"z":-1},{"x":0,"y":1,"z":0},0.2,0.3,
"WPN_"+(metadata.get(element, 'Display Name')).toString()+"-"+element.toString(),
USED_MODEL_WDG,element);
//occurance and model property seems to be ignorred in the data
where the function are defined as
/=======================================================================
//=======================================================================
$scope.app.waypoint_data_el={"position":{"x":-0.5,"y":0.5,"z":0},"gaze":{"x":0,"y":0,"z":-1},"up":{"x":0,"y":1,"z":0},"eventRadius":"0.2","wayfinderDisplayBoundary":"0.2","label":"Waypoint 1"}
//---------------------------------------------------------------------------------------------------------------------------
$scope.app.waypointElementSet=(el,pos,gaze,up,radEvent,radDisplay,label) =>{
el.position.x=pos.x;el.position.y=pos.y;el.position.z=pos.z;
el.gaze.x=gaze.x;el.gaze.y=gaze.y;el.gaze.z=gaze.z;
el.up.x=up.x;el.up.y=up.y;el.up.z=up.z;
el.eventRadius = radEvent;
el.wayfinderDisplayBoundary = radDisplay;
el.label = label;
return JSON.parse(JSON.stringify(el));
};
//=======================================================================
//that was for test adding model and occurence but is ignorred in the data at current time 9.24
//---------------------------------------------------------------------------------------------------------------------------
$scope.app.waypointElementSet2=(el,pos,gaze,up,radEvent,radDisplay,label,model,pathId) =>{
el.position.x=pos.x;el.position.y=pos.y;el.position.z=pos.z;
el.gaze.x=gaze.x;el.gaze.y=gaze.y;el.gaze.z=gaze.z;
el.up.x=up.x;el.up.y=up.y;el.up.z=up.z;
el.eventRadius = radEvent;
el.wayfinderDisplayBoundary = radDisplay;
el.label = label;
el.model=model
el['component-occurrence']=pathId
return JSON.parse(JSON.stringify(el));
};
//=======================================================================
$scope.app.waypointsReset= () => {$scope.app.waypointsdata=[];}
//=======================================================================
$scope.app.waypointsElementAdd=(pos,gaze,up,radEvent,radDisplay,label)=>{
let el= JSON.parse(JSON.stringify($scope.app.waypoint_data_el))
$scope.app.waypointsdata.push($scope.app.waypointElementSet(el,pos,gaze,up,radEvent,radDisplay,label));
};
//=======================================================================
//that was for test adding model and occurence but is ignorred in the data at current time 9.24
//=======================================================================
$scope.app.waypointsElementAdd2=(pos,gaze,up,radEvent,radDisplay,labe,model,pathIdl)=>{
let el= JSON.parse(JSON.stringify($scope.app.waypoint_data_el))
$scope.app.waypointsdata.push($scope.app.waypointElementSet(el,pos,gaze,up,radEvent,radDisplay,labe,model,pathIdl));
};
//=======================================================================
so I did some test in a deom project selecting a list of component in the meta data via search critieria and then creating list. Using that list then
Using the list I created there dynamicaly (depending on the search resutls) then waypoints data - so means that all found elements and create for them items
and we can then navigate to the list of waypoints: with next and prev:
here the highlighting is via script and using a shader.
Thank you,
I want to make sure I am reading this correctly: there is no way to set ComponentOccurence programmatically?
Could you share this project you referenced? I can check if that meets my needs. Thank you
yes, I planed to provide the project but needed some checks to complete , Here attached the demo project "WayfinderTest-asmSearch-add3-Communty" the pictures in the previous post are from that project. The demo /test project I created in Vuforia Studio 9.24. Possibly it will not work in older version of Studio.
Please, let me know if you have questions. Thanks