question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PLYLoader fails to parse PLYExporter output

See original GitHub issue

The error:

    TypeError: Cannot read property 'properties' of undefined
      33 |       .toEqual(plyData.toString('utf8'));
      34 | 
    > 35 |     const plyGeom = new THREE.PLYLoader().parse(plyData);
      36 |     expect(plyGeom.getAttribute('position').count)
      37 |       .toEqual(geom.vertices.length);
      38 |   });
      
      at parseASCII (node_modules/three/examples/js/loaders/PLYLoader.js:273:72)
      at Object.<anonymous>.THREE.PLYLoader.parse (node_modules/three/examples/js/loaders/PLYLoader.js:471:15)
      at _callee2$ (test/VFFLoader.test.js:35:43)

Here’s the repro.

    const plyData = await fixture('airway.vff.ply');
    expect(new THREE.PLYExporter().parse(exportMesh))
      .toEqual(plyData.toString('utf8'));

    const plyGeom = new THREE.PLYLoader().parse(plyData); // throws error
    expect(plyGeom.getAttribute('position').count)
      .toEqual(geom.vertices.length);

To test: (sorry for the annoying repro steps)

git clone git@github.com:CustomOrthopaedics/vff-loader.git
cd vff-loader
git checkout 766457
npm install
npm test

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gkjohnsoncommented, May 10, 2018

Hey @dbkaplun! It sounds like VFF is a point cloud format, which the ply exporter doesn’t currently handle. I’d be happy to help with updating the exporter so it does, though.

I’m not able to run the repro steps at the moment, but it looks like the error on import might be because the face count is exported as a fractional number, which is obviously bad (and should probably throw an error when exporting).

Ultimately the exporter should be updated to handle point data export by omitting the element and face property fields in the header. I think the right solution would be to exclude the face list completely when exporting geometry with no index array, but that gets a bit more complicated when exporting an Object3D hierarchy with multiple meshes of different types. At the very least I can add that to the list of limitations of the exporter.

I’ll have to think about how to handle multiple meshes a bit more and look into what the PLY format offers to support that. I’ll add a couple issues in the PLY exporter repo when I get a chance, as well.

Thanks! Garrett

1reaction
donmccurdycommented, May 1, 2018

Another option would be GLTFExporter -> GLTFLoader, both of which do support point data.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PLYExporter – three.js docs
Instantiate an exporter const exporter = new PLYExporter(); // Parse the input and generate the ply output const data = exporter.parse( scene, ...
Read more >
three.js - threejs r82 plyloader with PointsMaterial and Points
I got it working again. All I needed to do was convert the geometry before creating the points. var geo = new THREE.Geometry()....
Read more >
Ply file reader - ALCA Profumerie
Select File, then Export Scans and choose plyVC in Scans output ... to define 3D polygonal models. ply:1: parse error After saving the ......
Read more >
Assimp: material.h File Reference
If the model format does not define this, it is left to the application to decide ... For very common texture types, such...
Read more >
threejs-ply-loader - npm
Node.js wrapper for three.js PLYLoader. Latest version: 2.0.2, last published: a year ago. Start using threejs-ply-loader in your project by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found