Syntax
[CPL,CVL,zz]=CPLofSGsliceauto(SG,[dz]);
Input Parameter
SG : | | Solid Geometry |
dz : | | minimal z change; default is soBB(SG)/50 |
Output Parameter
CPL : | | Closed Polygon Line |
CVL : | | Closed Vertex List of all z values |
zz : | | |
Examples
SGreadSTL; A=ans; SGrotateservo(A); B=ans
CPLofSGsliceauto(B);
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)
This function, CPLofSGsliceauto
, is designed to compute slices of a solid geometry (SG) at significant z distances. It returns a closed polygon line (CPL), a closed vertex list (CVL), and a list of z values (zz).
Input Parameters
- SG: The solid geometry object to be sliced.
- dz: The minimal change in the z-direction to consider a slice significant. If not provided, it defaults to the bounding box size in the z-direction divided by 50.
Output Results
- CPL: Closed Polygon Line representing the slice.
- CVL: Closed Vertex List of all z values.
- zz: List of z values where slices occur.
Algorithm Steps
- Remove surface edge points from the solid geometry using
SGremsurfedgepoints
.
- Calculate the bounding box size of the solid geometry using
sofBB
.
- Determine the
dz
value using getfuncparams
. If dz
is an integer, adjust it by dividing the bounding box size in the z-direction by dz
.
- Extract unique z-values from the vertex list of the solid geometry.
- Identify significant z-values where the change is greater than or equal to
dz
using circshift
to compare adjacent z-values.
- Adjust the identified z-values by a small shift (
sh
) to ensure precision.
- Round the z-values to the nearest division of
dz/2
using rounddiv
.
- Ensure uniqueness of the z-values.
- Compute the closed polygon line and vertex list for the identified z-values using
CPLofSGslice3
.
- If no output arguments are specified, display the number of slices and plot the solid geometry and slices using
SGfigure
, SGplot
, CVLplot
, and CVLzplotasCPS
.
Algorithm explaination created using ChatGPT on 2025-08-19 08:15. (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