SGreadSTL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Import/Export
Introduced first in SolidGeometry 3.1, Creation date: 2016-12-18, Last change: 2025-09-14

reads in an SG from an STL File

Description

reads also Colors and Alpha Value since SG 4.5
SG.VL - vertices
SG.FL - Faces
SG.col - global color value; used only if there is no field .FC
SG.aplha - alpha value
SG.FC - Face colors
reads also Frames and Framenames since SG 5.0
supports also spational relations since SG 5.4

See Also: SGreadSTL , SGwriteSTL , VLFLreadSTL , VLFLwriteSTL , STLAsctoBin , SGN2SGT , SGT2SGN , stldir

Example Illustration

 missing image of SGreadSTL(FName,mag,rel)

Syntax

[SG,H,AbC,FName]=SGreadSTL([FName,mag,rel])

Input Parameter

FName: File Name
mag: optional magnification value
rel: spatial relations and modifications by SGtransrelSG such as 'shrink','150

Output Parameter

SG: Solid Geometry
H: header string 80 chars
AbC: Attribute by Count per facet uint16(n), SG.FC=bgr162rgb(AbC);
FName: FileName

Examples

Read the STL-File of a current SimMechanics Block
SG=SGreadSTL(get_param(gcb,'ExtGeomFileName'))




Copyright 2016-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Last html export of this page out of FM database by TL: 2025-09-21