Javascript output structure error

benoitlahoz's picture

Hi !

Firstable, a big thanks for this site and the contributors ! This is a bible, and I can say that I'm learning QC at Kineme !

Here is my trouble, and I guess this is a simple problem of variable declaration in Javascript... But well... I can't manage to output a structure from this code !

In input I have a structure of 4 values structures (Mesh vertices). What I want is to output a new structure of 3 values structure (Points structure), so for each substructure I "pop" the last element.

But my code seems to be wrong and it returns an error : "TypeError : Result of 'MeshVerticesArray' [null] is not an object".

Here is the code :

function (__structure LineStructure) main (__structure MeshVerticesArray)
{
   for (i = 0; i < MeshVerticesArray.length; i++) {
 
      for (j = 0; j < 3; j++) {
 
         LineStructure[i][j] = MeshVertices[i].pop();
 
      }
 
   }
   var result = new Object();
   result.LineStructure = LineStructure;
   return result;
}

Could you please help me ? Am I doing things the right way ?

Thanks a lot in advance !

Ben

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

benoitlahoz's picture
Re: Javascript output structure error

Well, I guess I have the answer in this thread : http://kineme.net/forum/Discussion/General/ReturnStructuresJavascriptPatch

I didn't know the "testMode". 'have to study QC Javascript before posting... :-)

Thank you !