Code covered by the BSD License  

Highlights from
STL to ACIS SAT conversion

4.0

4.0 | 4 ratings Rate this file 46 Downloads (last 30 days) File Size: 78.7 KB File ID: #27174
image thumbnail

STL to ACIS SAT conversion

by

 

06 Apr 2010 (Updated )

Convert an STL file into ACIS SAT, which can be more readily imported into various CAD packages.

| Watch this File

File Information
Description

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.
 
 
USAGE:
======
>> CONVERT_stl_to_sat(STLfilename)
or
>> CONVERT_stl_to_sat(STLfilename,STLformat)

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
 
 
EXAMPLE:
========
>> CONVERT_stl_to_sat('sample.stl')
 
converts the STL file 'sample.stl' into an ASIC SAT file called 'sample.sat'.
 
 
STL REQUIREMENTS:
=================
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.
 
 
OTHER NOTES
===========
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.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
29 Nov 2012 Adam A

Hi Alonso,
The function tells you the path to the output .sat file, displaying it in the command window. Have you tried looking in that location?
Adam

21 Nov 2012 Alonso

hi Adam
it seemed to work well, but i can't find the .sat file anywhere, even in the default carpet that Matlab save its data
Thanks

14 Jun 2012 Adam A

Hi Pele,
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.)
Adam

13 Jun 2012 Pele E

Hi Adam,
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?

06 Jun 2012 Adam A

Hi TCH,
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.
Adam

02 Jun 2012 TCH

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.

05 Aug 2011 Adam A

Hi Curtis,
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.)

04 Aug 2011 Curtis

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?

01 Aug 2011 Adam A

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.

22 Jul 2011 Kevin Moerman

Is it possible to group faces that have similar orientations?

22 Jul 2011 Kevin Moerman

Imports fine into Pro/ENGINEER and also CUBIT. Thanks!

Updates
07 Apr 2010

7th April 2010: Optimisation of the WRITE_sat.m code. Conversion now runs 10-15% quicker for large meshes.

07 Apr 2010

Added H1 headers.

29 Apr 2010

Added automatic removal of zero-area facets.

07 May 2010

Optimised the WRITE_sat.m code, giving a speed increase of 30-40% for larger meshes.

17 May 2010

Another 20-25% speed improvement.

25 May 2010

Minor bug fix.

22 Aug 2011

Added extra checks to test if the input mesh meets requirement 5. Also, small speed improvement for import of binary STL files.

06 Jun 2012

If the code fails due to a problematic facet, a plot is now displayed to show the location of that facet.

Contact us