christopherpoole / CADMesh

A CAD file interface for GEANT4
MIT License
146 stars 66 forks source link

SolidWorks 2017 SP5.0-generated STL model triggers DoesNotMatchExactly("facet normal") #34

Closed Yen-Yung closed 4 years ago

Yen-Yung commented 4 years ago

Hi,

I used to be able to import SW-generated STL files using CADMesh 1.x a few years ago. Recently I updated to 2.0.2 and presumably also a newer version of SolidWorks, SW 2017 SP5.0, to restart the project. I am getting error

The CAD file appears to contain incorrect syntax: Error around line 1: Facets are indicated by the tag 'facet normal'.

from DoesNotMatchExactly("facet normal"). Is there a setting I missed when converting SW parts to STL or is this a bug? I am also attaching the STL I tried here. Thanks!

-- Yen-Yung

update 200707: I can import your bunny.stl, so it must be something wrong with SW-generated STLs... update 200708: found the problem being the first line of the STL file

solid assembly - 300K_can-1 facet normal -9.993034e-002 0.000000e+000 -9.949945e-001 outer loop vertex 1.867302e+002 5.450940e+001 3.775120e+000 vertex 1.765321e+002 1.742470e+003 5.317435e+000 vertex 2.131847e+002 1.742470e+003 2.110749e+000 endloop endfacet ...

It doesn't like the original name "assembly - 300K_can-1," nor "300K_can" or "300Kcan," but accepts "Kcan" and "kcan." I guess numbers and special characters are not allowed.

christopherpoole commented 4 years ago

Thanks for reporting this. It looks like only names with letters are accepted. I will fix this right away.

christopherpoole commented 4 years ago

@Yen-Yung The CADMesh.hh header file in the master branch should fix this problem for you now.