Print Page | Close Window

Can anyone please help with this lisp routine?

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=157
Printed Date: 31.May.2026 at 21:24


Topic: Can anyone please help with this lisp routine?
Posted By: increase
Subject: Can anyone please help with this lisp routine?
Date Posted: 06.Oct.2007 at 07:51
Hello,

I have this lisp routine to output data to excel

(defun C:PEXPXL ( / ss lst fname fil sel2lst)
(defun sel2lst ( sel / l len )
(if (= 'PICKSET (type sel))
(repeat (setq len (sslength sel))
(setq len (1- len)
l (cons (ssname sel len) l)
) ;setq
) ;repeat
) ;if
)
(setvar "CMDECHO" 0)
(princ "\nSelect Circle,Polyline,Ellipse,Spline or Region")
(if
(and
(setq ss (ssget '((0 . "CIRCLE,*POLYLINE,ELLIPSE,REGION,SPLINE"))))
(setq lst (sel2lst ss))
(setq fname (getfiled "Select Excell file" "" "xls" 1))
)
(progn
(setq fil (open fname "w"))
(write-line "Object\tPerimeter" fil)
(foreach en lst
(command "_AREA" "_Object" en)
(write-line (strcat (cdr(assoc 0 (entget en)))"\t" (rtos (getvar "PERIMETER") 2 12)) fil)
)
(close fil)
(princ "\nPerimeter of ")(princ (length lst))
(princ " object export to ")(princ fname)
)
)
(princ)
)
(princ "\nType PEXPXL to run")
I would like the routine to automatically select 'all' lines, arcs etc and save as a text file
automatically without having to select through the menu, press enter and save the file

I also want to include in the output a count of objects, for instance in the attached
sample the number of objects would be 14

Can anyone help please, I am running this on Intellicad 6.4 SE

sample drawing here

http://www.divshare.com/download/2222051-d92 - http://www.divshare.com/download/2222051-d92






Print Page | Close Window