CVLzremovearea
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CVLz/Slices
Introduced first in SolidGeometry 4.9, Creation date: 2020-08-23, Last change: 2025-09-14
removes areas with a small distance to the opposite wall
Description
Uses CPLfindsmalldist
See Also: CPLfindsmalldist
, CVLzaddauxpoints
, CVLzofSGsliceauto
, CVLzplotasCPS
, CVLzplotui
, CVLzseparate
, CVLzsweep
Example Illustration
Syntax
CVLN=CVLzremovearea([res])
Input Parameter
res: | | minimal required distance to survive as contour |
Output Parameter
CVLN: | | CVL with removed areas the will creates problems during printing or SG reconstruction |
Examples
SG=SGservosample(1); CVLz=CVLzofSGsliceauto(SG);
SGfigure; CVLzplotasCPS(CVLzseparate(CVLz,1),'r',1); shg; grid off
SGfigure; CVLzplotasCPS(CVLzremovearea(CVLzseparate(CVLz,1),0.3),'r',1); shg; grid off
Copyright 2020-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 algorithm is designed to remove areas from a closed polygon list (CVL) that have a small distance to the opposite wall, which could cause issues during printing or solid geometry (SG) reconstruction.
Input Parameters
- CVL: The closed polygon list from which areas are to be removed.
- res: The minimal required distance for a contour to survive. If not provided, it defaults to 0.025.
Output
- CVLN: The modified closed polygon list with problematic areas removed.
Algorithm Steps
- Retrieve the minimal required distance parameter
res using getfuncparams. If not specified, default to 0.025.
- Initialize
CVLN as a copy of the input CVL.
- Separate the
CVL into different z-levels using CVLseparatez.
- Iterate over each z-level:
- Extract the contour list
CPLi and its index CLI for the current z-level.
- Use
CPLfindsmalldist to identify and remove areas with distances smaller than res.
- Add the z-level back to the modified contour list using
VLaddz.
- Update
CVLN by replacing the original contours with the modified ones.
- If no output is requested, plot the original and modified contours:
- Use
SGfigure to create a new figure.
- Plot the modified contours in red using
CVLzplotasCPS.
- Overlay the original contours in black and the remaining contours in green using
CVLzplot.
- Disable the grid and add annotations to distinguish between the original and remaining contours.
Algorithm explaination created using ChatGPT on 2025-08-19 08:26. (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