I have 73 lisp routines that work on heavy polylines. 23 of those work with both heavy and lightweight polylines.
The different code requirements can be significant.
The entity data of a POLYLINE has a POLYLINE entity and a series of VERTEX subentities followed by a SEQEND entity:
((-1 . <Entity name: 12cbd82e260>) (0 . "POLYLINE") (330 . <Entity name: 12c1c229020>) (5 . "2E756") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDb2dPolyline") (66 . 1) (10 0.0 0.0 0.0) (70 . 0) (40 . 0.0) (41 . 0.0) (210 0.0 0.0 1.0) (71 . 0) (72 . 0) (73 . 0) (74 . 0) (75 . 0))
((-1 . <Entity name: 12cbd82e270>) (0 . "VERTEX") (330 . <Entity name: 12cbd82e260>) (5 . "2E757") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbVertex") (100 . "AcDb2dVertex") (10 5702.25 3142.7 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (70 . 0) (50 . 0.0))
((-1 . <Entity name: 12cbd82e280>) (0 . "VERTEX") (330 . <Entity name: 12cbd82e260>) (5 . "2E758") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbVertex") (100 . "AcDb2dVertex") (10 5750.53 3142.7 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (70 . 0) (50 . 0.0))
((-1 . <Entity name: 12cbd82e290>) (0 . "VERTEX") (330 . <Entity name: 12cbd82e260>) (5 . "2E759") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbVertex") (100 . "AcDb2dVertex") (10 5750.53 3194.04 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (70 . 0) (50 . 0.0))
((-1 . <Entity name: 12cbd82e2a0>) (0 . "VERTEX") (330 . <Entity name: 12cbd82e260>) (5 . "2E75A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbVertex") (100 . "AcDb2dVertex") (10 5775.93 3194.04 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (70 . 0) (50 . 0.0))
((-1 . <Entity name: 12cbd82e2a0>) (0 . "VERTEX") (330 . <Entity name: 12cbd82e260>) (5 . "2E75A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbVertex") (100 . "AcDb2dVertex") (10 5775.93 3194.04 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (70 . 0) (50 . 0.0))
((-1 . <Entity name: 12cbd82e2b0>) (0 . "SEQEND") (330 . <Entity name: 12cbd82e260>) (5 . "2E75B") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (-2 . <Entity name: 12cbd82e260>))
The entity data of a LWPOLYLINE is just one entity; however, it has a quintuplet of ASSOC lists for each vertex (10, 40, 41, 42 and 91):
((-1 . <Entity name: 12cbd82e260>) (0 . "LWPOLYLINE") (330 . <Entity name: 12c1c229020>) (5 . "2E756") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "C-PROFV$TE$") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0)
(10 5702.25 3142.7) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)
(10 5750.53 3142.7) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)
(10 5750.53 3194.04) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)
(10 5775.93 3194.04) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)
(210 0.0 0.0 1.0))
It is less data but getting and using the data from these two types of polylines involves entirely different code. I find it much easier to set PLINETYPE=0 to be able to use my tried and true code than it is to recode 50± autolisp routines. This is especially true since all of the code I have changed thus far can use either type of polyline.
AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
8.6.52.0 AutoCAD Architecture 2024