@CodeDing
Thanks, it was quite helpful.
I am further trying to modify your code for some changes. I am trying to get one additional column (capacity) in csv .So I will search for the attributed block with a single tag inside each polygon whose value always be numeric which I will fetch .So here is my try
change
(setq output '("Layer,Vertex X,Vertex Y,Label"))
to
(setq output '("Layer,Vertex X,Vertex Y,Label,Capacity"))
For finding block inside polyline
;find the block inside pline
(if (setq ssBLK (ssget "_CP" pList '((0 . "INSERT"))))
(setq blkatt (getpropertyvalue (ssname ssBLK 0) "Attributes"))
(setq blkatt "-No block found-")
);if
further changing
(setq output (cons (strcat lyr ",,," txt) output))
(foreach p pList
(setq output (cons (strcat "," (rtos (car p) 2 4) "," (rtos (cadr p) 2 4) ",") output))
);foreach
);repeat
(setq output (reverse output))
to
(setq output (cons (strcat lyr ",,," txt "," blkatt) output))
(foreach p pList
(setq output (cons (strcat "," (rtos (car p) 2 4) "," (rtos (cadr p) 2 4) ",") output))
);foreach
);repeat
(setq output (reverse output))
Is this approach correct?
Thanks