Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

STL Files

Read and write STL files (ascii and binary formats)
(369 downloads for this version - 799 downloads for all versions)
Details
Version
2.1
Author
Jerome Briot
Maintainer
Jerome Briot
Category
License
Supported Scilab Version
6.0
Creation Date
August 11, 2018
Description
            Toolbox to read and write STL files (ascii and binary formats)

* Installation:
1. Download and extract the Zip file
2. Run builder.sce script in the sources folder 
3. Run loader.sce script in the sources folder 
4. Run demos in the *demos* folder 

* To read data from a STL file:
t = stlread(filename, fmt)

* To write data to a STL file:
stlwrite(t, filename, fmt)

Arguments:
- filename: a character string containing the path of the STL file
- fmt: a character string specifying the format of the STL file (e.g.
"ascii" or "binary")
- t: a tlist of type stldata

* Data storage:
Data are stored in a tlist of type stldata

The list fields are:
- header: the string at the begining of the STL file
- x: a [3xn] matrix wich represent the X coordinates of the model (one colum per
facet)
- y: a [3xn] matrix wich represent the Y coordinates of the model (one colum per
facet)
- z: a [3xn] matrix wich represent the Z coordinates of the model (one colum per
facet)
- normals: a [3xn] matrix wich represent the normals of the model (one colum per
facet)

* Data display in the Scilab console:

The display of the data is overloaded. Example:

-->t
 t  =
 
 Summary
   Header:    >3D Systems - View: ship.stl                                   
                
   #faces:    828 triangles
   #vertices: 2484 (non unique)

 Vertices coordinates [x y z] (first 5 only)
   2.02900 1.62800 0.91100
   2.22900 1.62800 0.91100
   2.22900 1.67200 0.91100
   2.22900 1.67200 0.91100
   2.02900 1.67200 0.91100
   ...

 Normals coordinates [x y z] (first 5 only)
   0.00000 0.00000 0.00000
   0.00000 0.00000 0.00000
   1.00000 1.00000 1.00000
   0.00000 0.00000 0.00000
   0.00000 0.00000 0.00000
   ...


* 3D model display:
The 3D model is displayed using the plot3d function:

figure

tcolor = 2*ones(1, size(t.x,"c"))

plot3d(t.x, t.y, list(t.z,tcolor));

a = gca()
a.isoview = "on"

* Bibliography
- John Burkardt's website: http://people.sc.fsu.edu/~jburkardt/data/data.html

- The STL Library: http://www.eng.nus.edu.sg/LCEL/RP/u21/wwwroot/stl_library.htm)

* Version history
2.1 - August 11, 2018 - Bug fix when reading header in STL binary file.
2.0 - March 19, 2017  - First release for Scilab 6
1.0 - August 26, 2016 - First release for Scilab 5.5
            
Files (1)
[20.56 kB]
Source code archive

News (0)
Comments (1)     Leave a comment 
Comment from Philipp Muehlmann -- November 23, 2020, 09:41:12 AM    
Hi,

I have a binary STL file, that contains 40644 points and 81284 triangles.


Trying to read this with stlread yields:


variable size exceeded : less than 2147483647 expected.


Where does this come from?

Thank you,
Philipp
Answer from S G -- May 20, 2023, 04:50:24 PM    
Confirmed.
The issue is reported @ https://gitlab.com/scilab/scilab/-/issues/17055
A work-around is also provided.
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.