PDA

View Full Version : Routine Error



nirekire
2004-08-02, 12:36 PM
I recently found this routine on the web that will list all blocks in a drawing and provide the x,y,z insertion coordinates in a .txt file report. The routine is exactly what I'm looking for, however it does'nt seem to always work?

Here is the message I get:
"Error: bad argument type: lselsetp nil"

That variable is not defined in the routine? I don't understand where the variable is coming from or what's setting it to nil? What am I missing?

I work with lisp very little and I'm hoping someone can help me identify why I get the error message and what it will take to correct the problem.

I'm currently using 2004.
TIA

matt.worland
2004-08-02, 01:27 PM
Thomas,

After you get the error, is there anything in the text file?

Matt

nirekire
2004-08-02, 02:39 PM
Matt,

Sometimes the text file contains nothing more than the column headings, i.e.;
BLOCK LOCATIONS, X-Y-Z COORDINATES

Sometimes it contains a few of the blocks and their locations, i.e.;
3196MTX 1.5X3-10 40HP 3600RPM

2216.02 1835.81 216.00

3196MTX 3X4-10 20HP 1200RPM

2968.24 1289.04 216.00

In both cases, the error is the same and the text file is incomplete.
Any help is appreciated.

Thx

mjfarrell
2004-08-02, 03:30 PM
Why not use the Tools > Attribute extraction tool to do this?

matt.worland
2004-08-02, 04:18 PM
It is hard to say what is causing the error with out being able to duplicate it.The error is a problem with the selection set. I have tried a few drawings with no luck duplicating your error. I will work on it a bit more, but hopefully someone else has a fix to it. Mr Farrell has a good alternative solution in the mean time.

Matt

RobertB
2004-08-02, 06:49 PM
... it does'nt seem to always work?

Here is the message I get:
"Error: bad argument type: lselsetp nil"

Could you please zip up a drawing that causes this error and attach it to a message in this thread?

Jeff_M
2004-08-02, 07:19 PM
It appears to error out when you have an anonymous block created via the hatch command.
I've modified a portion of the "get-blist" function and it appears to work properly now.


(defun get-blist (/ i blist)
(setq ss (ssget "X" '((0 . "INSERT"))))
(if ss
(progn
(setq i (- 1)
blist nil
) ; setq
(repeat (sslength ss)
(setq en (ssname ss (setq i (1+ i)))
blkname (dxf 2 en)
) ;_ setq
(if (and (not (wcmatch blkname "`**"));added this check
(not (member blkname blist))
)
(setq blist (append blist (list blkname)))
) ;_ if
) ; repeat
(setq blist (vl-sort blist '<));moved from end of func
) ; progn
(progn
(alert "No block references found.")
;(exit) not needed
) ; progn
) ; if
(if blist
blist
nil
);return blist or nil
) ; get-blist

HTH

RobertB
2004-08-02, 07:24 PM
It appears to error out when you have an anonymous block created via the hatch command.

Good catch! I hadn't got to the point of checking anonymous blocks.

nirekire
2004-08-02, 08:31 PM
Thanks for all the help and suggestions!

I tried the modified code and still received the same error, however we have some nested blocks within that drawing and wondering if that would cause the same error message?
My next question... can that be passed through some code without error?

mjfarrell... I'm feeling realy stupid.
I remember using the advanced attribute extraction tool for something else sometime ago and after trying it per your suggestion it jogged a memory switch.

I'd still like the routine to work if possible... but that will work with some modification to the tables if all else fails.

Unfortunately, I can not share the electronic files because of business reasons.

TIA

RobertB
2004-08-02, 08:45 PM
Nested blocks do not cause that error.