CAD software discussion forum > CAD > Lisp and Blocks

Lisp and Blocks

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 1 of 2

08-05-2009 05:34 . pm | View his/her posts only
When I redefine blocks with Lisp, the INSERT of blocks is wrong. The preview of the block looks OK, but when inserting the block, the original (first) block definition is hanging at the cursor. The final result, after picking a point, depends on the choices of 'Specify on screen' - they are different!
If you do not specify on the screen, the first definition is taken. If you don't, the redefined block is taken.

For 'handmade' blocks, eveything is working well.


The blockname has 8 regular characters.
The Lisp routine is a simple one:
- blname has been defined, and there is a selection set ss
(if (tblsearch "block" blname)
(command "-block" blname "y" ipcor ss "")
(command "-block" blname ipcor ss "")
)
I'm working with the Trail version ZWCad 2009 prof.

Someone any idea?

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 2 of 2

08-05-2009 06:47 . pm | View his/her posts only
Hello,

this is probably a bug, maybe using ENTMAKE functions for creating the insert would solve the problem.

another workaround could be:

(defun c:insert_block ()
(setq ss (ssget))
(setq ipcor (getpoint "'nSelect insertion point:"))
(setq e (ssname ss 0))
(setq el (entget e))
(setq blname (dxf 5 el))
(command "-block" blname ipcor ss "")
(command "_insert" blname)
)

(defun dxf (code elist) (cdr (assoc code elist)))

You could add a purge for unwanted blocks too.
See also