Skip to main content
1-Visitor
July 15, 2019
Question

Populating a grid widget from Thingworx repository

  • July 15, 2019
  • 1 reply
  • 1569 views

How can I populate a grid widget from the files in a thingworx repository and view the files in vuforia studio? The files will be in a PDF format.

1 reply

21-Topaz I
July 16, 2019

Hi @Rmcrabb ,

 

my understanding for  your quesiton - it consist of 2 different points.

1.) the first one is the quesiton how to display pdf files in AR - here in studio project. For this I want to refer to the post 

Displaying / Accessing Files (e.g PDF) in AR Application

2.) How to get files from repository- I think it is possible and you can get a  image file form repository via the LoadImage service.

Now tested and  it was working. So have an project with a 2d image widget with the name/ id "image-1". 

Also I have a Thingworx repository thing with the name "My_image-File":

2019-07-16_18-20-46.jpg

 

In the external data added the TWX repository and the service LoadImage.

 

2019-07-16_18-14-58.jpg

 

So the following code:

 

//////////////////////////////////////////////////////////////
$scope.GetImageFromTwxRepository = function(path) {
 $scope.$applyAsync(function() {
 $rootScope.$broadcast('app.mdl.My_images-File.svc.LoadImage',
 {"path":path}
 );} ,500 ); 
 console.log("after calling GetImageFromTwx");
};

////////////////////////////////////////////////////////////////
$scope.$on('$ionicView.afterEnter', function() {
 //register the complet svc for evaluating of the data 
 $scope.$root.$on('LoadImage-complete', function(event, args) { 
 console.log("LoadImage-complete event");
 var ret_str='data:image/gif;base64,'+args.data[0].Content;
 $scope.view.wdg['image-1']['imgsrc']=ret_str; 
 });
 
$timeout( function () {$scope.GetImageFromTwxRepository('/uhr.gif');},2500);
//start the method with 2,5 sec delay 
});

This will display the image form the repository in to the image widget:

 

2019-07-16_18-26-10.jpg

Rmcrabb1-VisitorAuthor
1-Visitor
July 16, 2019

Can a PDF be loaded with that same service?

21-Topaz I
July 17, 2019

I think for formats where we do not have the special service (json, text image) we could use instead the general binary service of the file repository thing  - SaveBinary / and LoadBinary to save or load any other file formats (e.g.  pdf)

So with such service you can load the pdf file but ... you cannot set to the source of the Image to display it and need to check more detailed the point 1.) what I mention in my previous post