ChHarding / TouchTerrain_for_CAGEO

Touch Terrain: A python app to create 3D printable terrain models (STL/OBJ) from only elevation data (via Google Earth Engine) or from a local geotiff. Has been used for CNC terrain models. Runs as a web app (http://touchterrain.org), as .py file (standalone.py) or as jupyter notebook. Docker image: https://github.com/ChHarding/TouchTerrain_jupyter_docker
http://touchterrain.geol.iastate.edu
191 stars 44 forks source link

Possible Invalid STL File #64

Closed keerl closed 1 year ago

keerl commented 1 year ago

I am trying to import an STL into a program called PyCAM. When I import it I get many errors about invalid triangles:

Skipping invalid triangle: (160.36862182617188, 6.439293542825908e-15, 0.0) / (160.36862182617188, 6.439293542825908e-15, 39.96474075317383) / (158.62548828125, 6.439293542825908e-15, 40.60410690307617) [many more...]

Inconsistent normal/vertices found in facet definition 21833 of '/pycam/tmptc037vdc.stl'. Please validate the STL file!

The model ends up loading but is missing the edges of the STL. The top mesh seems fine. It seems like data connecting the bottom rectangle data to the top mesh is corrupt possibly?

Screenshot 2022-12-05 at 7 31 25 AM

The STL seems to load fine in other programs so I'm not sure if most programs have built-in validation and PyCAM does not.

Any ideas?

ChHarding commented 1 year ago

Karl, this is b/c the (flat) bottom consist of only 32 triangles to optimize the triangle count (which can delimited be our server quota). On the API side I think there’s a way to force it to have the same number to triangles on the bottom as on the top but I have to look if and how that would be exposed to the web app. If needed it’s easy to put in an override flag. I’ll get back to you.

On Dec 5, 2022, at 09:04, Karl Schmaltz @.**@.>> wrote:

I am trying to import an STL into a program called PyCAMhttps://pycam.sourceforge.net/. When I import it I get many errors about invalid triangles:

Skipping invalid triangle: (160.36862182617188, 6.439293542825908e-15, 0.0) / (160.36862182617188, 6.439293542825908e-15, 39.96474075317383) / (158.62548828125, 6.439293542825908e-15, 40.60410690307617) [many more...]

Inconsistent normal/vertices found in facet definition 21833 of '/pycam/tmptc037vdc.stl'. Please validate the STL file!

The model ends up loading but is missing the edges of the STL. The top mesh seems fine. It seems like data connecting the bottom rectangle data to the top mesh is corrupt possibly?

[Screenshot 2022-12-05 at 7 31 25 AM]https://user-images.githubusercontent.com/24727492/205669258-cc56b585-bb6b-4c84-ab46-dcc81920bd33.png

The STL seems to load fine in other programs so I'm not sure if most programs have built-in validation and PyCAM does not.

Any ideas?

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_for_CAGEO/issues/64, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5NFTTZMCMEJLFTA3VDWLYAA5ANCNFSM6AAAAAASUMFDAI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

ChHarding commented 1 year ago

Just looked at the code and it’s not trivial to add an option to force a “full” bottom. Do you actually need the bottom? If not you could use “no_bottom”:true ….

On Dec 5, 2022, at 09:57, Harding, Chris [GE AT] @.**@.>> wrote:

Karl, this is b/c the (flat) bottom consist of only 32 triangles to optimize the triangle count (which can delimited be our server quota). On the API side I think there’s a way to force it to have the same number to triangles on the bottom as on the top but I have to look if and how that would be exposed to the web app. If needed it’s easy to put in an override flag. I’ll get back to you.

On Dec 5, 2022, at 09:04, Karl Schmaltz @.**@.>> wrote:

I am trying to import an STL into a program called PyCAMhttps://pycam.sourceforge.net/. When I import it I get many errors about invalid triangles:

Skipping invalid triangle: (160.36862182617188, 6.439293542825908e-15, 0.0) / (160.36862182617188, 6.439293542825908e-15, 39.96474075317383) / (158.62548828125, 6.439293542825908e-15, 40.60410690307617) [many more...]

Inconsistent normal/vertices found in facet definition 21833 of '/pycam/tmptc037vdc.stl'. Please validate the STL file!

The model ends up loading but is missing the edges of the STL. The top mesh seems fine. It seems like data connecting the bottom rectangle data to the top mesh is corrupt possibly?

[Screenshot 2022-12-05 at 7 31 25 AM]https://user-images.githubusercontent.com/24727492/205669258-cc56b585-bb6b-4c84-ab46-dcc81920bd33.png

The STL seems to load fine in other programs so I'm not sure if most programs have built-in validation and PyCAM does not.

Any ideas?

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_for_CAGEO/issues/64, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5NFTTZMCMEJLFTA3VDWLYAA5ANCNFSM6AAAAAASUMFDAI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://touchterrain.geol.iastate.edu/

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

keerl commented 1 year ago

When I try to enable no_bottom I get this error: 'NoneType' object has no attribute 'get_copy'

ChHarding commented 1 year ago

Hmm, can I get more details on the error? Or how tricky would it be for me to reproduce your workflow so I can run it in my debugger?

On Dec 8, 2022, at 12:41, Karl Schmaltz @.**@.>> wrote:

When I try to enable no_bottom I get this error: 'NoneType' object has no attribute 'get_copy'

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_for_CAGEO/issues/64#issuecomment-1343173500, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5OIPGNQPUFZT467FRDWMITTZANCNFSM6AAAAAASUMFDAI. You are receiving this because you commented.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

keerl commented 1 year ago

I am unable to recreate the issue now. It was likely caused by something else in my code.

ChHarding commented 1 year ago

So does no bottom solve your issue when importing in mode into the other software you mentioned?

On Dec 10, 2022, at 16:26, Karl Schmaltz @.**@.>> wrote:

I am unable to recreate the issue now. It was likely caused by something else in my code.

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_for_CAGEO/issues/64#issuecomment-1345398065, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5NJSWDOK4BKD4BVS6TWMT7QRANCNFSM6AAAAAASUMFDAI. You are receiving this because you commented.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

keerl commented 1 year ago

I actually ended up switching to another software (for unrelated reasons) and the problem doesn't exist there.