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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Error saving project $ is not a function TypeError: $ is not a function

JR_10569306
4-Participant

Error saving project $ is not a function TypeError: $ is not a function

I just updated my Vuforia Studio and am not running into this error whenever I preview. I get this pop up: '$ is not a function" and in my log I get "Error saving project $ is not a function TypeError: $ is not a function". This is happening for each of my projects, which all worked yesterday.

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks,

I think some of my projects were corrupted when I ran the update. I am going to try to update again later today or tomorrow and will see if that is the issue. 

View solution in original post

5 REPLIES 5
aletenti2
6-Contributor
(To:JR_10569306)

Hi, could you please share your .js code? Maybe the error is there.

JR_10569306
4-Participant
(To:aletenti2)

It is an issue across several projects that all worked without issue prior to the update. Oddly enough, I can import the same projects and have them work but the projects that I already have in my Vuforia Studio do not work. One common thread appears to be linking to a JSON.

 

Here is the code;

// $scope, $element, $attrs, $injector, $sce, $timeout, $http, $ionicPopup, and $ionicPopover services are available

//Define Constants used in Script
var PICK_COLOR = "rgba(0,255,0,1)"; //sets color to selected part
var MODEL_JSON = {'coffeemaker':'CoffeeMaker.json'}; //variable to set JSON schema for part identification

var infodataloaded = false;
var curseq = "";

//Define Needed Arrays
$scope.modelData = [];
$scope.modelDataProperties = [];
$scope.modelDataSequences = [];


//Touch and Part ID
$timeout( function(){
angular.forEach($element.find('twx-dt-model'), function(value, key) {
angular.element(value).scope().$on('userpick',function(event,target,parent,edata) {
var idpath = JSON.parse(edata).occurrence;
console.log(target);

console.log("the target is:"+ target)
var data = $scope.modelData [target];

if (data != undefined){
if(edata != "" && $scope.currentSelection != undefined){
tml3dRenderer.setColor($scope.currentSelection,"");
}
idpath = "/0/0";
if (edata != "") {
idpath = JSON.parse(edata).occurrence;
}
$scope.currentSelection = target + "-" + idpath;

tml3dRenderer.setColor($scope.currentSelection, PICK_COLOR);
console.log($scope.currentSelection)
var pname = data[idpath].name;
if (pname == undefined || pname == ""){
pname = idpath; }

$scope.view.wdg['partinfopanel'].visible = true;
$scope.view.wdg['label-9'].text = "Part name: " + pname;
x = angular.element(document.getElementById('partinfopanel'));
$timeout(function(){ document.querySelector('.PartInfoPanel').style.display = 'inline'; }, 100);
$timeout(function(){
document.querySelector('.PartInfoPanel').style.display = 'none';
}, 2000);
}
});
});
}, 0);

 

angular.forEach(MODEL_JSON, function(value, key) {
$http.get('app/resources/Uploaded/' + value).
success(function(data,status,headers,config){
$scope.modelData [key] = data["PartInfo"];
$scope.modelDataProperties [key] = data["Properties"];
$scope.modelDataSequences [key] = data["Sequences"];
})
.error(function(data,status,headers,config){
});

});

 

Hi @JR_10569306 ,

in the code you provided there is no error- it work in preview, not that what is possibly intended but there is no error. 

So to test this issue I believe further data is required.

e.g. the CoffeeMaker.json file and the pvz model. I believe there a PTC model with similar name but I could not find exactly the same name. I found the the following (attached version of coffemaker - in the attached upload zip with the metadata json, but It seems that it is not suitable to the code- so int the extracted metadata there are not properties like "PartInfo"  

Therefore to be able to test the code , we need the model and the json file which should be loaded from the upload project folder.

But what I could mention there   is that there are no syntax error in the code. Possibly there is some data corruption in your project.

You can create a new project and test when there is no error (so means your Studio installation is OK) then you can try then to replace the Home.js and Home.json in the project  and try open the project again if there is an issue.

What is the Studio version what you use- is the last one. Possibly you updated to 9.12 and then try to open with 9.10 - then this will not work there are several errors.

Also when I do import the code incompletely in a new proejct  - so still the userpick is working in this case:

2023-07-11_16-12-03.jpg

Thanks,

I think some of my projects were corrupted when I ran the update. I am going to try to update again later today or tomorrow and will see if that is the issue. 

It was an issue with the upgrade. Rerunning the update solved this issue.

Top Tags