SGreadOBJ

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Import/Export
Introduced first in SolidGeometry 4.4, Creation date: 2018-11-30, Last change: 2025-09-14

reads in an OBJ file

Description

Simply uses VLFLreadOBJ
Since there are different formats in OBJ files
currently only the format
f v1 v2 v3
and f v1/vn v2/vn v3/vn
and f v1//vn v2//vn v3//vn
are supported

See Also: SGreadSTL , SGwriteSTL , VLFLwriteSTL , VLFLreadSTL , VLFLreadOBJ

Example Illustration

 missing image of SGreadOBJ(FName,mag,check)

Syntax

[SG,H,AbC,FName]=SGreadOBJ([FName,mag,check])

Input Parameter

FName: File Name
mag: magnification; default is 1
check: checker; default is false

Output Parameter

SG: Solid Geometry
H: Colors, not used in SG-Lib 4.7
AbC: Colors, not used in SG-Lib 4.7
FName: File Name, added in SG-Lib 4.7




Copyright 2018-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

Algorithm (Workflow)

The function SGreadOBJ is designed to read OBJ files and is part of the SG-Library. It primarily utilizes the VLFLreadOBJ function to handle the reading process. The function supports specific OBJ file formats, including:

These formats represent different ways of defining faces in an OBJ file.

Input Parameters

Output Results

Function Workflow

The function begins by extracting the input parameters using getfuncparams, which assigns default values if parameters are not provided. It then calls VLFLreadOBJ with the input arguments to read the OBJ file and obtain the vertex list (SG.VL), face list (SG.FL), and other outputs.

The function assigns the file name to SG.stampname and records the current date and time in SG.stampdate.

If no output arguments are specified, the function visualizes the geometry using SGfigure and SGplotalpha, setting a default view angle and title based on the file name.

Algorithm explaination created using ChatGPT on 2025-08-19 06:49. (Please note: No guarantee for the correctness of this explanation)

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