PDA

View Full Version : Now desperate for dimension extraction help



kitewader
20th Jun 2005, 02:01 pm
Can anyone please help. We are looking for a LISP routine that will list the dimensions of lines of the selection to a simple list that we can import into excel. My knowledge of LISP is not quite as advanced as zero, but I know this can be done and it would save me hours.

Anyone, please……………

fuccaro
20th Jun 2005, 02:40 pm
Something like THIS (http://cadtutor.net/forum/viewtopic.php?t=1785&) one?

kitewader
20th Jun 2005, 03:56 pm
fuccaro, you are a giant amongst men. That's superb - in fact all we need is the length. The start,end, centres etc are superfluous but we can just delete those columns in the spreadsheet.

Thanks again!

fuccaro
21st Jun 2005, 05:55 am
... all we need is the length. The start,end, centres etc are superfluous but we can just delete those columns in the spreadsheet.
... or adjust the lisp code to export only what you need.

kitewader
21st Jun 2005, 09:30 am
Easy for you to say, as a complete novice in LISP it's easier to delete the excel data. I did try to alter the code but just got nowhere.
Thanks for your help and suggestions again.
Of course, if you were bored one day and wanted something to do.........

fuccaro
21st Jun 2005, 02:03 pm
;| Program to export line lengths into a CSV file
mfuccaro@hotmail.com
---------------------------June 2005
|;
(defun c:LL2F( / name file ss ssi enl)
(setq name (getvar "dwgname")
file (open (getfiled "Output file..." name "CSV" 1) "w")
ss (ssget) ssi -1)
(if ss
(progn
(repeat (sslength ss)
(setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
(if (= "LINE" (cdr (assoc 0 enl)))
(write-line (rtos (distance
(cdr (assoc 10 enl))
(cdr (assoc 11 enl)))) file)))))

(close file)
(princ)
)

kitewader
21st Jun 2005, 02:44 pm
Thanks for that. When I try to load it it gives an error command of:

; error: bad character read (octal): 0

Is it operator error (me) of a glitch in the code??

fuccaro
21st Jun 2005, 02:48 pm
I gived it a quick try and it worked for me. Please try again and return here with a new message. I will see tomorrow what can I do.

kitewader
21st Jun 2005, 03:45 pm
Hi,
No, still getting the same error.

Here’s what I’ve done.
Pasted the code into wordpad, saved it as ll2f.lsp
I get a “ll2f.lsp successfully loaded message” in the Load/Unload Applications Dialogue Box.
The command line then shows:
Command: _appload ll2f.lsp successfully loaded.
Command: ; error: bad character read (octal): 0

If I enter “ll2f” in the command line it gives:

Unknown command "LL2F". Press F1 for help.

The other (lst.lsp) LISP loads and runs fine.

I appreciate your help.

fuccaro
22nd Jun 2005, 06:00 am
Well, this time I am out of ideas. Maybe try to use Notepad instead of Wordpad :?:

kitewader
22nd Jun 2005, 09:48 am
Your reputation remains untarnished. For no logical reason that I can see, using Notepad instead of Wordpad has solved the problem.

Thanks for all your help. You are a genius!!

hendie
22nd Jun 2005, 10:14 am
Wordpad adds character formatting which messes with the txt format

kitewader
22nd Jun 2005, 12:50 pm
Ah-Ha Hendie - that would explain that. Thanks