RE: SLC file (long)

Date: Wed Feb 24 1999 - 02:53:59 EET


SLC was a proposed new RP standard file format from 3D Systems. It has
some very good features, but never really caught on. Below is the SLC
specification and source code for a viewer courtesy of 3D. Cheers!


                Dear SLC Developer,

                Enclosed is the SLC file format information you
requested. The SLC format is a contour-based, layer representation of
CAD data. It is a complement to the standard STL tessellated format,
which is widely used for many rapid prototyping applications. This
format is ideal for solid modeling as well as surface models and other
data that is already arranged in a layer format, such as CT-scan data.

                Attached is the SLC File Specification technical
description along with a disk containing a sample SLC file. You may use
these to assist in your development of the SLC interface for your

                If you have any technical questions regarding this
specification please contact Chris Manners at 3D Systems, (805) 295-5600
ext. 416

                Best Regards,

                Jenine McQuaid
                Product Marketing Manager
                3D Systems

1. Introduction

        The SLC file format is a "21/2D" contour representation of a CAD
model. It consists of successive cross-sections taken at ascending Z
intervals in which solid material is represented by interior and
exterior boundary polylines. SLC data can be generated from various
sources, either by conversion from CAD solid or surface models or more
directly from systems that produce data arranged in layers, such as

2. Definition of Terms

                2.1 Segment

        A segment is a straight line connecting two X/Y vertice points.

                2.2 Polyline

        A polyline is an ordered list of X/Y vertice points connected
continuously by each successive line segment. The polyline must be
closed whereby the last point must equal the first point in the vertice

                2.3 Contour Boundary

        A boundary is a closed polyline representing interior or
exterior solid material. An exterior boundary has its polyline list in
counter-clockwise order. The solid material is inside the polyline.
An interior boundary has its polyline list in clockwise order and solid
material is outside the polyline.
                Figure 1: Contour Boundary Description

                2.4 Contour Layer

        A contour layer is a list of exterior and interior boundaries
representing the solid material at a specified Z cross-section of the
CAD model. The cross-section slice is taken parallel to the X/Y plane
and has a specified layer thickness.
3. Data Formats

                                        Byte 8 bits
                                        Character 1 Byte
                                        Unsigned Integer 4 Bytes
                                        Float 4 Bytes
IEEE Format

                                Most significant byte of FLOAT is
specified in the highest addressed byte. The byte ordering follows the
Intel PC Little Indian/Big Indian scheme.

                                        Address 0 1 2
                                                        Low Word
High Word
                                                        LSB MSB LSB MSB

                                Most UNIX RISC Workstations are Big
Indian/Little Indian, therefore they need to byte swap all Unsigned
Integers and Floats before outputting to the SLC file.
4. Overview of the SLC File Structure

                                The SLC file is divided into a header
section, a 3D reserved section, a sample table section, and the contour
data section.
                4.1 Header Section

                                The Header section is an ASCII character
string containing global information about the part and how it was

                                The header is terminated by a carriage
return, line feed and control-Z character (0x0d,0x0a,0x1a) and can be a
maximum of 2048 bytes including the termination characters.

                                The syntax of the header section is a
keyword followed by its appropriate parameter.

                4.2 Header Keywords
                                4.2.1 "-SLCVER <X.X>" specifies the SLC
file format version number. The version number of this specification is

                                4.2.2 "-UNIT <INCH/MM>" indicates which
units the SLC data is represented in.
                                4.2.3 "-TYPE <PART/SUPPORT/WEB>"
specifies the CAD model type. PART and SUPPORT must be closed
contours. WEB types can be open polylines or line segments.
                                4.2.4 "-PACKAGE <vendor specific>"
identifies the vendor package and version number that produced the SLC
file. A maximum of 32 bytes.

                                4.2.5 "-EXTENTS <minx,maxx miny,maxy
minz,maxz>" describes the X, Y, and Z extents of the CAD model.

                                4.2.6 "-CHORDDEV <value>" specifies the
cordal deviation, if used, to generate the SLC data.

                                4.2.7 "-ARCRES <value in degrees>"
specifies the arc resolution, if used, to generate the SLC data.
                                4.2.8 "-SURFTOL <value>" specifies the
surface tolerance, if used, to generate the SLC data.

                                4.2.9 "-GAPTOL <value>" specifies the
gap tolerance, if used, to generate the SLC data.

                                4.2.10 "-MAXGAPFOUND <value>" specifies
the maximum gap size found when generating the SLC data.

                                4.2.11 "-EXTLWC <value>" specifies if
any line width compensation has been applied to the SLC data by the CAD

                4.3 3D Reserved Section

                                This 256-byte section is reserved for
future use.

                4.4 Sampling Table Section

                                The sample table describes the sampling
thickness (layer thickness or slice thickness) of the part. There can
be up to 256 entries in the table. Each entry describes the Z start,
the slice thickness, and what line width compensation is desired for
that sampling range.
                                        Sampling Table Size
1 Byte
                                        Sampling Table Entry
4 Floats

                                                Minimum Z Level
1 Float
                                                Layer Thickness
1 Float
                                                Line Width Compensation
1 Float
1 Float

                                The first sampling table entry Z start
value must be the very first Z contour layer. For example, if the
cross-sections were produced with a single thickness of 0.006 inches and
the first Z level of the part is 0.4 inches and a line width
compensation value of 0.005 is desired, then the sampling table will
look like the following:

                                        Sample Table Size
                                        Sample Table Entry
0.4 0.006 0.005 0.0

                                If for example, the part was sliced with
2 different layer thickness the Sample Table could look like the

                                        Sample Table Size
                                        Sample Table Entry 1
0.4 0.005 0.004 0.0
                                        Sample Table Entry 2
2.0 0.010 0.005 0.0

                                Slice thickness must be even multiples
of one other to avoid processing problems.
                4.5 Contour Data Section

                                The contour data section is a series of
successive ascending Z cross-sections or layers with the accompanying
contour data. Each Contour Layer contains the minimum Z layer value,
number of boundaries followed by the list of individual boundary data.
The boundary data contains the number of x,y vertices for that boundary,
the number of gaps, and finally the list of floating point vertice

                                The location of a gap can be determined
when a vertice point repeats itself.
                                To illustrate, given the contour layer
in section 2.4 the contour section could be as follows:
                                        Z Layer
                                        Number of Boundaries
                                        Number of Vertices for the 1st
Boundary 5
                                        Number of Gaps for the 1st
Boundary 0
                                        Vertex List for 1st Boundary
0.0, 0.0

1.0, 0.0

1.0, 1.0

0.0, 1.0

0.0, 0.0

                                * Notice the direction of the vertice
list is counter-clockwise indicating the solid material is inside the
polylist. Also, notice that the polylist is closed because the last
vertice is equal to the first vertice.

                                        Number of Vertices for the 2nd
Boundary 5
                                        Number of Gaps for the 2nd
Boundary 0
                                        Vertex List for 2nd Boundary
0.2, 0.2

0.2, 0.8

0.8, 0.8

0.8, 0.2

0.2, 0.2

                                * Notice the direction of the vertice
list is clockwise indicating the solid material is outside the polylist.
Also, notice that the polylist is closed because the last vertice is
equal to the first vertice.

                                The Contour Layers are stacked in
ascending order until the top of the part. The last layer, or the top
of the part, is indicated by the Z level and a termination unsigned
integer (0xFFFFFFFF).

                                Contour Layer Section Description

                                    Contour Layer
                                              Minimum Z Level
                                              Number of Boundaries
Unsigned Integer
                                                        Number of
Vertices Unsigned Integer
                                                        Number of Gaps
Unsigned Integer
                                                        Vertices List
(X/Y) Number of Vertices * 2 Float

                                        Repeat Number of Boundaries

                                    Repeat Contour Layer until Top of
                                    Top of Part
                                                      Maximum Z Level
1 Float
                                              Termination Value
Unsigned Integer (0xFFFFFFFF)
                        Minimum Z Level for a given Contour Layer

                                Note that a one-inch cube based at the
origin 0,0,0 can be represented simply by only one contour layer and the
Top of Part Layer data.

                                Suppose the cube was to be imaged in
0.010 layers. The sample table would have a single entry with its
starting Z level at 0.0 and layer thickness at 0.01. The contour layer
data section could be as follows:

                                        Z Layer
                                        Number of Boundaries
                                        Number of Vertices for the 1st
Boundary 5
                                        Number of Gaps for the 1st
Boundary 0
                                        Vertex List for 1st Boundary
0.0, 0.0

1.0, 0.0

1.0, 1.0

0.0, 1.0

0.0, 0.0
                                        Z Layer
                                        Termination Value

                                Notice that only one contour was
necessary to describe the entire part. The initial contour will be
imaged until the next minimum contour layer or the top of the part at
the specified layer thickness described in the sampling table. This
part could have had 100 identical contour layers, but that would have
been redundant. This is why the contour Z value is referred to as the
minimum Z value. It gets repeated until the next contour or top of the
5. Dumpslc Program

                Included with this specification is the source code to a
program that displays the contents of an SLC file. This program should
be used to verify the format of the SLC file and display its contents.

/* Program dumpslc.c
  SGI compile: % CC -DSWAP -o dumpslc dumpslc.c

  This Program is a utility program that dumps out slc files.

    Author: Chris R. Manners
    Date: 10/11/91

  SLC File Format:
    Ascii Header Max length 2048 ; ends with
character 0x1A
    Reserved section 256 bytes
    Sampling table section
        Table Size (number of entries) 1 byte
        Table entry 16 bytes
            Minimum Z value Float
            Layer Thickness Float
            LineWidth Compensation Float
            Reserved Float

                Contour Layer Section
                  Minimum Z Layer Float
                  Number of Boundaries Unsigned Integer
                    Number of Vertices Unsigned Integer
                        Number of Gaps Unsigned Integer
                        Vertices List (X/Y) Number of Vertices * 2 Float
                  Repeat Number of Boundaries - 1
                Repeat Contour Layer until Top of Part
                Top of Part
                  Maximum Z Layer Float
                  Termination Value 0xFFFFFFFF


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TRUE 1
#define FALSE 0

#ifdef SWAP

#define point_buffer_size 4096
#define reserved_size 256
const max_vertices = 2048;

/* sampling table entry has 4 entries */
struct sample_table_entry {
            float min_z_level;
            float layer_thickness;
            float beam_comp;
            float reserved;
// retrieve data from the SLC file and byte swap it if necessary
int readAndSwap(char* buffer,int size, int count,FILE* file,unsigned int
        char *s;
        int halfsize;
        char temp;
        int i,j,k,sizeprime;
        int n;

        if (!reverse || n<count || size<2) return n;
        sizeprime = size-1;
        for (i=0; i<count; i++,s+=size)
                for (j=0; j<halfsize; j++)
        return n;

// Process the slc header
void read_slc_header(FILE* fp)

    char head_char;
    while ( (head_char = getc(fp)) != 0x1A) putchar(head_char);


// Process the 3D Reserved Section
void read_reserved_section(FILE* fp)

  char key_char;
        for ( int i = 0; i < reserved_size; i++) key_char = getc(fp);


// read in the sampling table section; It contains a table length
// and the table entries
void read_table_entry(FILE* fp)
        int num_read;
  char table_entry_size;
  struct sample_table_entry sample_table;

  num_read = readAndSwap((char* )

  if (table_entry_size == 0)
    printf("Sampling Table Size is Zero!!!\n");

        printf("Sampling Table Size: %d\n\n",table_entry_size);
  printf( "Minimum Z Level Layer Thickness Line Width Compensation
  for ( int i = 0; i < table_entry_size; i++)
          num_read = readAndSwap((char* )
          printf(" %7.3f %7.4f %7.4f

// output the vertice points
void print_points(float buffer[],unsigned int numPoints)
  for ( unsigned int i = 0; i < (numPoints * 2); i += 2)
                printf("%9.6f, ",buffer[i]);

// process the vertice points for a given boundary
void process_points(long unsigned int numPoints,FILE* fp)
  float pointbuffer[point_buffer_size];
  unsigned int num_read, num_requested;

  while (numPoints != 0)
    if (numPoints > max_vertices)
                   num_requested = max_vertices * 2;
            num_read = readAndSwap((char* )
            if (num_read != num_requested)
                          printf("Error reading SLC data\n");
            print_points(pointbuffer,(unsigned int) max_vertices);
            numPoints = numPoints - max_vertices;
    else if (numPoints != 0)
      num_requested = (unsigned int) (numPoints * 2);
                   num_read = readAndSwap((char *)
            if (num_read != num_requested)
                          printf("Error reading SLC data\n");
                   print_points(pointbuffer,(unsigned int) numPoints);
            numPoints = 0;

// process a contour layer at a time until the Top of the Part
void process_contour_layers(FILE* fp)
  float minLayer;
  long unsigned int numContours,numPoints,numGaps;
  int num_read;

  numContours = 0;
  while (numContours != 0xFFFFFFFF)
    num_read = readAndSwap((char* )
    num_read = readAndSwap((char* )
    if (numContours != 0xFFFFFFFF)
            printf("Minimum Layer Number: %7.3f\n",minLayer);
                        printf("Number of Contours:
      for ( int i = 0; i < numContours; i++)
        printf("Contour: %d\n",i+1);
        num_read = readAndSwap((char* )
        num_read = readAndSwap((char* )
        printf("Number of Vertices: %u\n",numPoints);
        printf("Number of Gaps : %u\n",numGaps);
    else printf("Maximum Layer Number: %7.3f\n",minLayer);
        printf("\nEnd of SLC File.\n");

// open the slc file
FILE* openslcFile( char* fileName)
FILE *fp;

  if((fp = fopen(fileName,"rb")) == NULL)
          printf("Unable Open File: %s\n",fileName);
  printf("SLC file name: %s\n\n",fileName);

// process the entire slc file
void process_slc_file(char *fileName)
FILE* pslcfile;

  pslcfile = openslcFile(fileName);


void main(int argc,char **argv)

char fileName[256];

  if (argc > 1) strcpy(fileName,argv[1]);
                printf("Enter Contour File Name: ");



Dan Davis
PROTON Rapid Prototyping & Manufacturing Center
Hicom Industrial Estate
Batu Tiga, PO Box 7100
Shah Alam, 40918 Selangor MALAYSIA
+60 3 515-2380 phone/fax

> -----Original Message----- > From: Florent Salako [] > Sent: Friday, February 19, 1999 3:11 AM > To: > Subject: SLC file ? > > > Does anyone know what a slc file is (in RP) ? > Can I get a file example ? > > Thanks. > Florent. > > > > _________________________________________ > Florent Salako > Prototech Centre > > > Tel: (514) 340-3245-6 > Fax: (514) 340-3246 > > > > For more information about the rp-ml, see

For more information about the rp-ml, see

This archive was generated by hypermail 2.1.2 : Tue Jun 05 2001 - 22:51:03 EEST