I have a lisp that automatically inserts a block--sometimes multiple times.
When the block is inserted twice or more, the user is prompted whether or not to re-define the block.
Is there a system variable that I can set up to automatically re-define the block without a prompt?
I read through the variables but I couldn't find one that seemed to accomplish this but it wouldn't be the first time I've ovelooked what would have worked.
Thanks
AJS
#2
AJS,
This occurs probably because you are giving the full path at the insertion command.
To workaround this problem you can make an error routine. Please try the following:
Regards,
JCAMPOS
This occurs probably because you are giving the full path at the insertion command.
To workaround this problem you can make an error routine. Please try the following:
Code: Select all
(defun C:InsertMyBlock ( / temperr dwgFILE dwgNAME insertionPt Xscale Yscale rotAngle )
;; Define an error trap routine
(setq temperr *error*)
(setq *error* InsertMyBlockErrorTrap)
;; Set the block properties
(setq dwgFILE "C:\\MyBlock.dwg")
(setq dwgNAME "MyBlock")
(setq insertionPt (list 0.0 0.0 0.0))
;; Set the insertion defaults:
(setq Xscale 1.0)
(setq Yscale 1.0)
(setq rotAng 0.0)
;; Try to insert the block by giving only its name - dwgNAME - (and, of course, all of the insertion properties).
;; If the block hasn't been inserted yet, then the error routine is executed
(command "_.INSERT" dwgNAME insertionPt Xscale Yscale rotAng)
;; Exists quietly
(setq *error* temperr)
(princ)
)
;; Error trap routine:
;; This routine will be fired as soon as an error occurs in the main routine
;; It will insert the block if the block is not defined in the drawing.
(defun InsertMyBlockErrorTrap ( errmsg / )
;; Insert the block by giving the full path name - dwgFILE:
(command "_.INSERT" dwgFILE insertionPt Xscale Yscale rotAng)
)
JCAMPOS
#3
I use another way...
(defun c:test (/ block)
(if (null (tblsearch "block" "myblock"))
(setq block "c:\\my_folder\\myblock.dwg")
(setq block "myblock")
)
(while (setq p1 (getpoint "\n-> Insertion point : "))
(command "_.INSERT" myblock p1 1. 1. 0. [attributes values])
)
(princ)
)
e.fernal
http://www.gr-acad.com.br
(defun c:test (/ block)
(if (null (tblsearch "block" "myblock"))
(setq block "c:\\my_folder\\myblock.dwg")
(setq block "myblock")
)
(while (setq p1 (getpoint "\n-> Insertion point : "))
(command "_.INSERT" myblock p1 1. 1. 0. [attributes values])
)
(princ)
)
e.fernal
http://www.gr-acad.com.br