STL to ACIS SAT converter
Adam H. Aitkenhead
31st March 2010
Convert an STL file into an ACIS v4.0 SAT file (Standard ACIS Text), which can be more readily imported into various CAD packages (including Solidworks) as a solid model.
converts the stl file <STLfilename> into an ACIS SAT file. The optional string <STLformat> defines the format of the STL file as one the following:
'auto' - (The default option) Automatic detection of the file format
'ascii' - ASCII format
'binary' - Binary format
converts the STL file 'sample.stl' into an ASIC SAT file called 'sample.sat'.
The STL data must meet the following criteria:
1. All facets are triangular.
2. No duplicate or overlapping facets exist.
3. The mesh is properly closed.
4. The facet normals are properly defined.
5. For each facet edge, there must exist an odd number of identical edges on adjacent facets.
Although uncommon, some STL meshes may not meet requirement 5 and cannot be converted to SAT using this code.
For a description of the ACIS format, refer to: http://local.wasp.uwa.edu.au/~pbourke/dataformats/sat/sat.pdf
Depending on the hardware, conversion is performed reasonably quickly for STL meshes of up to a few thousand facets. For larger meshes the conversion time increases roughly with the square of the number of facets.
I have the same problem with TCH even though I can see which point violated requirement 5, I'm still confused about this situation. Can you kindly explain how would that happen or the mechanism behind this requirement? Is this requirement necessary because of the triangulation or something else? Thanks a lot!
Nice! Thanks a lot!
Thank you! Works well with stlwrite.
The function tells you the path to the output .sat file, displaying it in the command window. Have you tried looking in that location?
it seemed to work well, but i can't find the .sat file anywhere, even in the default carpet that Matlab save its data
The current version of the code doesn't support multiple solids in a single STL file, so I'm afraid you'll need to split the STL into a separate file for each solid before running the conversion. This is because the STL format itself doesn't explicitly support multiple solids. (Although an ascii STL file can be created with multiple solids, a binary STL file cannot, and I've written this code to work with both ascii and binary files.)
This works great for me with one solid, but if I have multiple solids in my .stl file, it still creates a single body in the .sat file - all the solids are lumped into one "body", but they have the correct co-ordinates etc. and are physically separate. Is this a limitation of ACIS SAT 4.0? Or does your code only ever create a single body in the .sat file?
I'm afraid I have no idea what your problem is as I have not seen the stl file you are having trouble with. However, I have updated the code to display the location of problematic facets. (The new version should be available in the next day or so.) Hope this helps you find where the problem lies.
The running procedure would always violate the fifth criterion (say "the stl file does not meet requirement 5: For each facet edge, there exists an odd number of identical edges on adjacent facets.") inadequate further information is available and prompted for further improvement of my stl file. The stl file I am using is generated from the stlwrite function authored by Grant Lohsen (see the link:http://www.mathworks.com/matlabcentral/fileexchange/36770-stlwrite-write-binary-or-ascii-stl-file)
I have used this file for a long time. Is there anything I could do to save this situation? I am indeed need the acis file format.
If you're able to email me a sample stl that shows the problem I'll see if I can find a way around it. (You can contact me via the 'contact author' link on my profile page.)
This is very useful.
However, if the .stl file to be converted was created from a mesh of geometry which had to be cut up (in CUBIT) before it could be meshed, it throws an error because it doesn't see that the mesh is watertight. Do you have any suggestions on how I might work around this?
Hi Kevin, glad you find the code useful. Regarding grouping faces into similar orientations - this might be possible, but I no longer have access to CAD software which reads ACIS files so I'm no longer able to develop/test the code.
Is it possible to group faces that have similar orientations?
Imports fine into Pro/ENGINEER and also CUBIT. Thanks!
If the code fails due to a problematic facet, a plot is now displayed to show the location of that facet.
Added extra checks to test if the input mesh meets requirement 5. Also, small speed improvement for import of binary STL files.
Minor bug fix.
Another 20-25% speed improvement.
Optimised the WRITE_sat.m code, giving a speed increase of 30-40% for larger meshes.
Added automatic removal of zero-area facets.
Added H1 headers.
7th April 2010: Optimisation of the WRITE_sat.m code. Conversion now runs 10-15% quicker for large meshes.