CAD/CAM discussion forum > CAD > insert block using lisp, autocad lisp insert block

insert block using lisp, autocad lisp insert block

    
  Subscribe Topic

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 1 of 4

 insert block using lisp, autocad lisp insert block
27-05-2009 09:02 . am   |   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 4

11-05-2009 04:36 . pm   |   View his/her posts only


Hi, JTEC, Thank you very much for your feedback. We have verified the problem. Our R&D is handling it now, and we will inform you as soon as it is sovled by Email and the Forum. If you have any other problems, please contact us freely.

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 3 of 4

25-05-2009 03:14 . pm   |   View his/her posts only
Workaround suggestion with block name based on handle. You could add a purge to remove unneccessary blocknames.

(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)))

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 4 of 4

27-05-2009 09:02 . am   |   View his/her posts only
[QUOTE=ZwCADtools]
Workaround suggestion with block name based on handle. You could add a purge to remove unneccessary blocknames.

(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)))


Hi,ZwCADtools

Thank you for your walk-around solution.
See also
X