Home    Search    Reference Manuals    Return    Misc Group Documentation





Users Manual for Program DECODE_STL





Table of Contents

   Introduction
   Calculation procedure
   Input data commands
   Example



Introduction

Program DECODE_STL reads a stl-file and translates it into an ASCII file containing OpenGL-commands, describing the geometrical shape of the body. The translated file can be inserted in your runf-file with the "insert"-command.



Calculation procedure



Input data commands

Input data is read in free format, valid separators between the input values are <space>, <comma>, <tab>, <equal sign> or <carriage return>. The commands can be written both in lower and upper case letters. The operation of the program is controlled by the commands described below; some of the commands also need arguments.

BODY_NAME
Name of the body.
Declared= Character*24    Default= 'car_1'
INFIL
STL file to be translated.
Declared= Character*256    Default= Blank
TYPE_INFIL
Type of input data file to be created.
Following values are valid:
formatted = Read INFIL as a formatted file
binary = Read INFIL as an unformatted file
Declared= Character*16    Default= 'binary'

NORMAL_DIR
The STL-file defines the model in nodes.
All nodes are defined with their coordinates and normals. The coordinates defines the position of the nodes, and the normals defines the orientation of the surface around each node.
In program glplot the normals are used to calculate how the light will reflect on the model. Unfortunately doesn't the STL-file tell if the normals are pointing outwards or inwards. The only way to find this out is to make a test run with NORMAL_DIR= 1 and see what happens. If the model looks very dark, rerun program decode_stl again and set NORMAL_DIR= -1.
Declared= Real*4
Default= 1.
ORIENT
Orientate the model in accordance to the definition of the coordinate axis as used in Gensys.
The orientation of the coordinate systems in Gensys is: calc.html#jLocalCoordinateSystems.
The values of the matrix ORIENT are given in the following order: ORIENT(1,1), ORIENT(1,2), ORIENT(1,3), ORIENT(2,1), ORIENT(2,2),,, etc.
Declared= Real*4(3,3)
Default= 1. 0. 0.
  0. 1. 0.
  0. 0. 1.

ORIGO
Move the model distance ORIGO. Array ORIGO has a dimension of 3, and shall be given in the original coordinate units of the model.
Declared= Real*4(3)
Default= 0. 0. 0.

SCALE
Multiply the model with SCALE.
SCALE is an array with dimension 3, which allows to have different scale factors in different directions: longitudinal, lateral and vertical.
Declared= Real*4(3)
Default= 1. 1. 1.
RED_DEFAULT
Default value for color red.
In case the STL-file is missing information about the color of geometrical figure, its value of red color will be set equal to RED_DEFAULT. Variable RED_DEFAULT is a real value, and its value can be set between 0 - 1.
Declared= Real*4    Default= 0.6 [m]
GREEN_DEFAULT
Default value for color green.
In case the STL-file is missing information about the color of geometrical figure, its value of green color will be set equal to GREEN_DEFAULT. Variable GREEN_DEFAULT is a real value, and its value can be set between 0 - 1.
Declared= Real*4    Default= 0.8 [m]
BLUE_DEFAULT
Default value for color blue.
In case the STL-file is missing information about the color of geometrical figure, its value of blue color will be set equal to BLUE_DEFAULT. Variable BLUE_DEFAULT is a real value, and its value can be set between 0 - 1.
Declared= Real*4    Default= 1. [m]
UTFIL
File containing the translated model.
Declared= Character*256    Default= Blank
TYPE_UTFIL
Type of output data file to be created.
Following values are valid:
figure_mass = Create a wire-frame model suitable for program Gplot
opengl_mass = Create a solid model suitable for program Glplot
Declared= Character*16    Default= 'opengl_mass'
END
Command which terminates further input data reading.



Example of an input data file

Following example: Master.decode_stlf can be used as a master file:

##
##  Input data for program "decode_stl"
##
                                                                              
   ORIGO =  0 0 0       # Distance to origo
   ORIENT=  1 0 0       # Rotation of the figure
            0 1 0
            0 0 1
   SCALE =  1 1 1       # In X-, Y- and Z-direction

   NORMAL_DIR =  1
   RED_DEFAULT  =  .6
   GREEN_DEFAULT=  .8
   BLUE_DEFAULT =  1.

   BODY_NAME= 'car_1'

   INFIL= car-body.stl
   TYPE_INFIL= binary

   TYPE_UTFIL= opengl_mass
   UTFIL= output.ins