kennethjiang / OctoPrint-Slicer

A full-blown GUI-based slicer plugin for OctoPrint
MIT License
99 stars 29 forks source link

Exception: Cannot read property 'point' of undefined #116

Open kennethjiang opened 7 years ago

kennethjiang commented 7 years ago

Stack trace: /static/webassets/packed_plugins.js in QuickHull.computeExtremes at line 12890:34 /static/webassets/packed_plugins.js in QuickHull.computeInitialHull at line 12948:33 /static/webassets/packed_plugins.js in QuickHull.compute at line 13306:14 /static/webassets/packed_plugins.js in QuickHull.setFromPoints at line 12641:14 /static/webassets/packed_plugins.js in new ConvexBufferGeometry at line 13684:37 /static/webassets/packed_plugins.js in new ConvexGeometry at line 13662:29 /static/webassets/packed_plugins.js in hullPointsFromGeometry at line 31507:26 /static/webassets/packed_plugins.js in Object.box3FromObject at line 31589:46 /static/webassets/packed_plugins.js in Object.box3FromObject at line 31638:48 /static/webassets/packed_plugins.js in STLViewPort.self.addModelOfGeometry at line 31844:37 /static/webassets/packed_plugins.js at line 31824:18 /static/webassets/packed_plugins.js at line 11765:13 /static/webassets/packed_plugins.js in XMLHttpRequest. at line 8981:298

kennethjiang commented 7 years ago

@eyal0 This exception happened to one of the users. Do you have any clue what could have been the cause of it?

eyal0 commented 7 years ago

Deep inside QuickHull, which isn't even code that I wrote. I got it from the three js examples.

Maybe the STL file was invalid? If it's repeatable, maybe the user can send you the STL file?

Compute initial hull tries to find the initial 4 sided shape to grow into a convex hull. Maybe there are less than 4 points in the shape, which is an illegal shape. Or maybe the shape is entirely flat, also illegal.

See if you can get the STL file.

kennethjiang commented 7 years ago

Got it! thx @eyal0 ! This error doesn't seem to happen often. Will keep an eye on it.

kennethjiang commented 7 years ago

Has not happened frequently. Closing it baed on the assumption it is one-off/browser-specific issue.

kennethjiang commented 7 years ago

This error occurs at the rate about 1 user/week. Impact all browsers.

eyal0 commented 6 years ago

I think that this is due to invalid STL. I tried chopping a file on my fork and made a layer so thin that it was one dimensional and it failed on QuickHull.

QuickHull tries to make a valid, 3D, convex hull. If the shape has all points in one plane, it can't make a volume from that and fails.

QuickHull is only used to find the minimum set of points that we need for computing the bounding box. If it fails, we can fall back to just using all the points of the object. I made a commit for that. (Ignore the min.js changes.) It looks but but most of the changes are whitespace. It's just adding a try-catch.

If you still get these complaints, maybe try that solution and see if the number reduces?