mohammadreza Posted October 2 Share Posted October 2 hello guys i have a lisp that is count few blocks and put in a specific coordinates in a frame (rectangle). but if i move that frame, lisp doesnt work correctly (because that coordinates doent update) actually i searched too much and i found need to use ''entmakex'' function , but need some help. is this below code wrong? why? (defun c:bb () (setq block_obj (car (entsel "Select the block: ")) block_name (cadr (assoc 2 (entget block_obj))) ; Retrieve the block name text_ent (car (entsel "Select the text: ")) ) (entmakex (list '(0 . "ASSOC") (cons 2 (cons block_name text_ent)) ; Associate the block and text entities (cons 10 (cons block_name (cadr (assoc 10 (entget block_obj)))) ) (cons 11 (cons block_name (cadr (assoc 10 (entget block_obj)))) ) (cons 12 (cons block_name (cadr (assoc 10 (entget block_obj)))) ) ) ) (command "regen") (princ) ) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 2 Share Posted October 2 What entity is ASSOC? This line : block_name (cadr (assoc 2 (entget block_obj))) ; Retrieve the block name Should be : block_name (cdr (assoc 2 (entget block_obj))) ; Retrieve the block name Quote Link to comment Share on other sites More sharing options...
mohammadreza Posted October 2 Author Share Posted October 2 (edited) 15 minutes ago, marko_ribar said: What entity is ASSOC? This line : block_name (cadr (assoc 2 (entget block_obj))) ; Retrieve the block name Should be : block_name (cdr (assoc 2 (entget block_obj))) ; Retrieve the block name (my block name is rect ) ,i still get error: Command: BB Select the block: Select the text: error: bad DXF group: (2 "rect" . <Entity name: 15af94c8>) Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. Edited October 2 by mohammadreza Quote Link to comment Share on other sites More sharing options...
Steven P Posted October 2 Share Posted October 2 Is this what you are trying to do? Have a block with a field that updates as you move the block? The block can be a simple rectangle with a point and attribute - the point doesn't have to lie on the rectangle perimeter to allow the text / rectangle to be offset. To entmake or entmakex the field you create an mtext object with the text string being the field definition - which you might get from following this link: https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/How-to-add-x-y-coordinates-to-block-attribute-in-AutoCAD.html#:~:text=Create a block with x,y coordinates as 1 Quote Link to comment Share on other sites More sharing options...
Saxlle Posted October 2 Share Posted October 2 According to @Steven P post, i think this will help you (I wanted to post an example dwg, but there is a link with a description). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.