defining a block in a lisp and check if the block is already defined in the drawing

Laura

Usenet Archive
Joined
Jul 21, 2003
Messages
54
Reaction score
0
I've a lisaproutine that requires a certain block defined in the drawing. A solution was inserting the block into the drawing and erasing it immediately. I used erase and ten "last". The problem is when the insertion point is outside view it erases a different "last" object.

(defun insertblock
(defun inserting (BLOCK scale / BASEPOINT)
(setq BASEPOINT (list 0 0 0))
(command "-insert" BLOCK "s" 1 BASEPOINT "")
(princ)
) ; end inserting

(inserting "CERTAINBLOCK" 1)
(command "erase" "last" "")
(princ)
) ; end insertblock

1. The first question is how can I erase that last inserted block?

2. The second question is, how can I see that the block is already defined in the drawing.
The following is not working.

(if (tblsearch "block" CERTAINBLOCK )
(go further with lisp) ; block exist
(insert block and go further with lisp) ; block doesn't exist ) ; end if

Thanks,

Laura
 
I forgot the " ". But why do your use "(not....." in it?

(defun c:blocksearch

(if (tblsearch "block" "Myblock")
(alert "myblock exist")
(alert "myblock doesn't exist")
) ; end if
); end defun

This is working. Thank you very much.

Greetings

Laura
 
i use not, so i do not have an else option in the if-function and after the if i can go on with the lisp, because now the block is defined in the dwg.
mfg

Laura wrote:

I forgot the " ". But why do your use "(not....." in it? (defun c:blocksearch (if (tblsearch "block" "Myblock") (alert "myblock exist") (alert "myblock doesn't exist") ) ; end if ); end defun This is working. Thank you very much. Greetings Laura "gert" <> schreef in bericht [URL="http://]]...

i guess this should work 2) (if (not (tblsearch "block" "MYBLOCK")) (progn insert the block and delete it ) ) now the rest of your lisp mfg Laura wrote:

I've a lisaproutine that requires a certain block defined in the drawing.

A

solution was inserting the block into the drawing and erasing it immediately. I used erase and ten "last". The problem is when the insertion point is outside view it erases a different "last" object. (defun insertblock (defun inserting (BLOCK scale / BASEPOINT) (setq BASEPOINT (list 0 0 0)) (command "-insert" BLOCK "s" 1 BASEPOINT "") (princ) ) ; end inserting (inserting "CERTAINBLOCK" 1) (command "erase" "last" "") (princ) ) ; end insertblock 1. The first question is how can I erase that last inserted block? 2. The second question is, how can I see that the block is already

defined

in the drawing. The following is not working. (if (tblsearch "block" CERTAINBLOCK ) (go further with lisp) ; block exist (insert block and go further with lisp) ; block doesn't exist ) ; end if Thanks, Laura
 
I thought so, but wanted a awnser to the problem anyway :)

I'll keep it in mind.

thanks

Laura
 

Latest threads

Back
Top