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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

metadata vuforia experience service

GianVal
15-Moonstone

metadata vuforia experience service

Hello, I'm using thingworx flow to get some pvz files from windchill ad upload them into vuforia experience service repository. The process works, but using these pvz into vuforia studio seems to not load the metadata automatically (as instead using thingworx repository does). How to solve this issue?
Can I extract the metadata of the gathered pvz and upload it as a separate file? How to do this into thingworx flow?

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions

There is an external extension https://github.com/mvonhasselbach/CreoViewRWExtension that will create the meta data. I have not used this with Thingworx flow. The approach I took was Thingworx OData and wrapper services which work well. The link is to a Thingworx extension you will need to install and create a service

 

logger.debug("Entering GetJSONFromCreoViewFile ");

var params = {
FileRepository: RepoName /* THINGNAME */,
ReturnedProperties: (returnedProps || undefined) /* STRING */,
CreoViewFile: pvzFilePath /* STRING */,
JSONFormat: format /* STRING */

};

// result: JSON

var result = Resources["CreoViewRWHelper"].GetJSONFromCreoViewFile(params);

In my case I place the pvz and the meta.json in the same Thingworx Repo and provide the url to the pvz source. The meta.json file needs to be in the same relative location
 
I used a GUID for the pvz and meta,json file names as they need to be the same for example xxxx,pvz xxxx.metadata.json 
 
Does this help
 
 
 

View solution in original post

12 REPLIES 12

Hi @GianVal , 

I tried to answer to this topic  in the related post :https://community.ptc.com/t5/Vuforia-Studio/metadata-vuforia-experience-service/m-p/778822#M10621

 

There is an external extension https://github.com/mvonhasselbach/CreoViewRWExtension that will create the meta data. I have not used this with Thingworx flow. The approach I took was Thingworx OData and wrapper services which work well. The link is to a Thingworx extension you will need to install and create a service

 

logger.debug("Entering GetJSONFromCreoViewFile ");

var params = {
FileRepository: RepoName /* THINGNAME */,
ReturnedProperties: (returnedProps || undefined) /* STRING */,
CreoViewFile: pvzFilePath /* STRING */,
JSONFormat: format /* STRING */

};

// result: JSON

var result = Resources["CreoViewRWHelper"].GetJSONFromCreoViewFile(params);

In my case I place the pvz and the meta.json in the same Thingworx Repo and provide the url to the pvz source. The meta.json file needs to be in the same relative location
 
I used a GUID for the pvz and meta,json file names as they need to be the same for example xxxx,pvz xxxx.metadata.json 
 
Does this help
 
 
 

Hi @sgreywilson ,

this seems to be a great extension which will add more meta data information as the Studio UI  functionality allows. This extension seems to create a   metadata json which will contain  the bound and the tranformation this  could be very helpful for some components operations. e.g.:

... "__PV_SystemProperties" : {
      "Display Name" : "COLUMN_ASSY.ASM",
      "Part Path" : "/Illustration/MINI_MILL_ASSY.ASM/COLUMN_SPINDLE.ASM/COLUMN_ASSY.ASM",
      "Child Count" : 48,
      "Component Name" : "COLUMN_ASSY.ASM",
      "Model Extents (mm)" : 589.1,
      "Instance Location" : "0.0 0.0 0.0 0.0 0.0 0.0 ",
      "Part Name" : "COLUMN_ASSY.ASM",
      "Model Bounds" : "-0.1274 0 -0.397 0.095326185 0.5891 0",
      "Direct Child Count" : 25,
      "Instance Transformation" : "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1",
      "Model Transformation" : "1 0 0 0 0 1 0 0.096 0 0 1 -0.259 0 0 0 1",
      "Model Location" : "0.0 0.0 0.0 0.0 0.096 -0.259 ",
      "OL File Name" : "",
      "Part Depth" : 3,
      "Instance Type" : 0,
      "Instance ID" : "2",
      "Part ID Path" : "/0/2/2"
    },
...

 I am not sure if the UI will add  this info when we have a Windchill assembly (which are published from Windchill - possibly extended by some attribures) but I believe this TWX extension is more powerfull. Thanks

Hi @RolandRaytchev 

 

It is very useful extension - I forgot to mention as with any extension there comes some risk of version support  but without it you can't do what you require! 

 

I have used the bounding box to position multiple models. 

 

   

 

PositionModel = function (modelname , offset) {

var boundingboxViaParams = $scope.app.params.CURRENT_BOUNDING_BOX;

$scope.view.wdg[modelname].visible=false;

try {

var boundingbox = $scope.app.mdl['WCHelper'].svc['GetRepresentations'].data.current['BoundingBox'];

if (boundingbox != null && boundingbox != "") {
/*
"BoundingBox": [
-0.379386, .................X1 (0)
-1.15892, .................Y1 (1)
-0.0983161, ...............Z1 (2)
0.379386, .................X2 (3)
-0.0766029, ...............Y2 (4)
0.740562 ..................Z2 (5)
],

*/


var loadedModelPosX = -1.0*(boundingbox.array[0] + boundingbox.array[3]) / 2.0;
var loadedModelPosZ = -1.0*(boundingbox.array[2] + boundingbox.array[5]) / 2.0;
var loadedModelPosY = -1.0* (boundingbox.array[1]);
$scope.view.wdg[modelname].y=loadedModelPosY;
$scope.view.wdg[modelname].z=loadedModelPosZ;


if (offset == true) {

let move = (Math.abs(boundingbox.array[0]) + Math.abs(boundingbox.array[3]) + (Math.abs(boundingbox.array[0]) + Math.abs(boundingbox.array[3]))*0.1 );
$scope.view.wdg[modelname].x=loadedModelPosX + move ;

} else {
$scope.view.wdg[modelname].x=loadedModelPosX ;
}

}

} catch (ex) {


}


$scope.view.wdg[modelname].visible=true;

}

 

GianVal
15-Moonstone
(To:sgreywilson)

This seems to be a good solution. But I'm forced to work into Thingworx Flow. So I'm not certain i can integrate it.

You can wrap thingworx service info flow services I beleive

 

GianVal
15-Moonstone
(To:sgreywilson)

Sorry, can you explain better the procedure you are referring to? Many thanks

You can call Thingworx services using flow. So any  service extension you want to call you can wrap in a Thingworx service - does that make sense ?

 

sgreywilson_0-1645219687918.png

 

GianVal
15-Moonstone
(To:GianVal)

I'm having trouble importing the extension. please can you list the actions to achieve the import?

many thanks

Furthermore  I tested this extension today and I was able to get it working . So I was able  to create a json file from pvz file which was located in the e.g. reposistory path /CreoViewRWExtTest/RGV_Cassette.pvz  of the Thing/ repository  "CADtestRepository"

After the import of the extension I opend the Thing "CreoViewRWTester" and created a service myTEST

var params = {
	FileRepository: "CADtestRepository" /* THINGNAME */,
	ReturnedProperties:  undefined /* STRING */,
	CreoViewFile: "/CreoViewRWExtTest/RGV_Cassette.pvz"/* STRING */,
	JSONFormat: "DEFAULT" /* STRING */
};

// result: JSON
var result = Resources["CreoViewRWHelper"].GetJSONFromCreoViewFile(params);

 

Output result - type JSON  no input parameters. The result json object output should be written to the same directory (where I took the pvz) as json file

I used SaveJSON service of CADtestRepository. To define this in workflow I used a appkey of the es-public-access user. Therefore I set the permissions to execute service of both services SaveJSON and myTEST to execute for the es-public-user. This will allow the Flow connector could call both services

 

2022-02-21_15-36-23.jpg

 

There I used a workflow of 2 execute service elements- 1.) srv   myTEST and  output a JSON which is used as input to the second 2.) src element  CADtestRepository.SaveJSON . Afrter starting this flow it added the json object to the folder  created from the pvz file.

 

2022-02-21_16-00-49.jpg

Top Tags