Convert scanner from meters to millimeters?


How can I get the scanner to use millimeters instead of meters?


@timterry73 scaling the mesh vertex data by 1000 before saving the mesh is the way to accomplish that. Or, do the scaling when importing the data into whatever editing / modeling program you’re using.



what files/lines of code do i need to change in the “scanner sample” to update the mesh vertex data before saving?


@timterry73, take a look at the documentation for STMesh. presentMeshViewer in is a good example of how to iterate through the mesh data.

Assuming you’re using [STMesh writeToFile] to save the mesh, you’ll want to do your scaling before writeToFile is called in the function emailMesh in



@jim_selikoff, I’m trying to scale down to millimeters but am a little lost. I tried creating a new GLKVector3 and then assigning it here

    [meshToSend meshVertices:i] = vertexUpdating

but am getting a warning “Assigning to ‘readonly’ return result of an Objective-C message not allowed.”
How can we scale the vertex if this is a read only? Should I be looking somewhere else?

STMesh* meshToSend;

for ( int i=0; i<_mesh.numberOfMeshes; ++i)
    int numVertices = [_mesh numberOfMeshVertices:i];
    const GLKVector3* vertex = [_mesh meshVertices:i];

    GLKVector3* vertexUpdating;
    for( int j=0; j<numVertices; j++ )
        vertexUpdating[j].x = vertex[j].x * .001;
        vertexUpdating[j].y = vertex[j].y * .001;
        vertexUpdating[j].z = vertex[j].z * .001;
    [meshToSend meshVertices:i] = vertexUpdating

BOOL success = [meshToSend writeToFile:zipPath options:options error:&error];



I believe it is just a matter of changing the syntax used in the following line:

[meshToSend meshVertices:i] = vertexUpdating


[meshToSend meshVertices(i): vertexUpdating]


meshToSend.meshVertices(i) = vertexUpdating

I believe I have the correct syntax above, but JIC I found the solution on the following page:


@anthony.monaco I’m getting errors with each of those.

[meshToSend meshVertices(i): vertexUpdating]

At the first parenthesis I’m getting an error - Expected ‘]’
I noticed the stack overflow answer had added the word “set” so I tried experimenting with that but couldn’t get it to work.

And for

meshToSend.meshVertices(i) = vertexUpdating

Error - Property ‘meshVertices’ not found on object of type ‘STMesh *’

Do you have any other ideas? Can the meshVertices be set?

GLKVector3 scaleFactor = GLKVector3Make(0.001, 0.001, 0.001);
[self.meshRef meshVertices:0][0] = GLKVector3Multiply([self.meshRef meshVertices:0][0],scaleFactor);

That compiles :slight_smile:


@jim_selikoff @anthony.monaco Great! Got it working, thanks for your help.


What @synthesize statement did you use and where?


@cgranthovey Could you please post the solution you had for converting the scale from Meter to Millimeter?