Syntax
[SGN,h]=SGstackn(SG,n,[dz])
Input Parameter
SG : | | Solid geometry |
n : | | number |
dz : | | distance in z; default is 1mm |
Output Parameter
SGN : | | Stacked solid geometries |
h : | | height of stack in z |
Examples
SGstackn(SGDIN433(2.5),3); % Stacking Washer for a Ball Bearing
Copyright 2013-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)
This function, SGstackn
, is designed to stack solid geometries vertically along the z-axis. It is part of the SG-Library and was introduced in SolidGeometry 1.1.
Input Parameters
- SG: The solid geometry to be stacked.
- n: The number of times the solid geometry should be stacked.
- dz: The distance between each stacked geometry along the z-axis. If not provided, the default value is 1 mm.
Output Results
- SGN: The resulting stacked solid geometries.
- h: The total height of the stack along the z-axis.
Algorithm Steps
- Retrieve the
dz
parameter from varargin
, defaulting to 1 if not specified.
- Initialize
SGN
with the input solid geometry SG
.
- Calculate the bounding box
BB
of the solid geometry using BBofVL
.
- Iterate from 1 to
n-1
to create additional stacked geometries:
- For each iteration, create a copy of
SG
named SGi
.
- Translate
SGi
along the z-axis by i*(dz + BB(6) - BB(5))
using VLtransP
.
- Concatenate
SGi
to SGN
using SGconcat
.
- Calculate the total height
h
of the stack as (BB(6) - BB(5)) * n + dz * (n - 1)
.
- If no output arguments are specified, plot the stacked geometries using
SGfigure
, SGplotsurfaces
, and SGTframeplot
.
Example Usage
The function can be used to stack a washer for a ball bearing three times with the following call:
SGstackn(SGDIN433(2.5), 3);
Algorithm explaination created using ChatGPT on 2025-08-19 00:43. (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