Entity to Point List

Function Syntax (LM:ent->pts <ent> <acc>)
Current Version 1.2
Download EntityToPointListV1-2.lsp
View HTML Version EntityToPointListV1-2.html
Donate
Arguments
Symbol Type Description
ent Ename Entity name of object to be described by point list (POINT/LINE/ARC/CIRCLE/LWPOLYLINE/POLYLINE/ELLIPSE/SPLINE)
acc Number Positive & non-zero numerical value to determine the point density for non-linear objects
Returns
Type Description
List List of WCS points describing or approximating the supplied entity, else nil if object type is not supported

Function Description

This function will return a list of points, defined relative to WCS, describing or approximating a supplied entity.

The function currently supports Lines, Arcs, Circles, Ellipses, Elliptical Arcs, LWPolylines, Polylines, Splines and Points; and has been engineered to describe the supplied entity using fewer points where possible whilst still maintaining a good approximation to supplied curve.

Linear objects (Lines, Points & Polylines with linear segments), may be described exactly by the returned point list, whereas curves (Arcs, Circles, etc.) are approximated whilst minimising the size of the returned point list.

Test Program

The following test program will prompt the user to select an object and, following a valid selection, will then proceed to create an AutoCAD Point at each point returned by the LM:ent->pts function:

Select all
(defun c:test ( / ent )
    (if (setq ent (car (entsel)))
        (foreach pnt (LM:ent->pts ent 50.0)
            (entmake (list '(0 . "POINT") (cons 10 pnt)))
        )
    )
    (princ)
)
(vl-load-com) (princ)

Examples of Output for Various Entity Types

Arcs Circles Ellipses Elliptical Arcs Polylines Splines

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010