CPL2DXF

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Import/Export
Introduced first in SolidGeometry 5.0, Creation date: 2021-01-26, Last change: 2025-09-15

Returns LWPOLYLINE strings with increasing object number

Description

ATTENTION: This function works different if called with pcnt==76;

See Also: CPLwriteSVG , CPLwriteDXF

Example Illustration

 missing image of CPL2DXF(CPL,pcnt)

Syntax

texta=CPL2DXF([CPL,pcnt])

Input Parameter

CPL: CPL to convert into LWPOLYLINEs
pcnt: already existing number of objects; default is 76

Output Parameter

texta: textstring for inserting into DXF file

Examples


CPL2DXF(CPLsample(9),0)
CPL2DXF(CPLsample(9)) % first LWPOLYLINE command is missing




Copyright 2021-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, CPL2DXF, is designed to convert a closed polygon list (CPL) into a DXF text format. The function is part of the SolidGeometry library and was introduced in version 5.0. Below is a detailed explanation of the algorithm and its parameters.

Input Parameters

Output

Algorithm Steps

  1. The function starts by retrieving the CPL and pcnt parameters using the getfuncparams function. If not provided, default values are used.
  2. An empty string, texta, is initialized to store the resulting DXF text.
  3. The function separates the CPL into individual polygons using the separateNaN function, which counts the number of polygons (nc).
  4. For each polygon (k from 1 to nc), the following steps are executed:
  5. After processing all polygons, the initial '0' in texta is removed to finalize the output.
Algorithm explaination created using ChatGPT on 2025-08-19 08:03. (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