If you have a little bit of time it would be great if you add some comments to your code
Assuming variables '
b' & '
c' point to DXF data for an LWPolyline entity, the above expressions will return a list of vertices for the polylines described by the supplied DXF data lists.
You can see this by stepping through the expressions one expression at a time:
In the following example, assume that the variable '
elist' contains the following LWPolyline DXF data:
(
(-1 . <Entity name: 7ef03b88>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef01cf8>)
(5 . "359")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbPolyline")
(90 . 4)
(70 . 0)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 17.3428 14.1773)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 19.951 16.9304)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 23.6196 14.0079)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(10 26.652 17.0151)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(91 . 0)
(210 0.0 0.0 1.0)
)
Evaluating the
vl-remove-if-not expression leaves only the DXF group 10 entries (you can read this literally from the expression:
"remove if the first element of each list item is not equal to 10"):
(
(10 17.3428 14.1773)
(10 19.951 16.9304)
(10 23.6196 14.0079)
(10 26.652 17.0151)
)
Now, the
mapcar expression evaluates the
cdr function on each of these DXF group 10 items, returning each list with the first item (the DXF group code) removed, thus returning the vertex coordinates:
(
(17.3428 14.1773)
(19.951 16.9304)
(23.6196 14.0079)
(26.652 17.0151)
)