Suha Posted February 24, 2023 Posted February 24, 2023 Hello Guys, Say, I have created a block with a single circle entity in it: (entmake '((0 . "BLOCK") (2 . "myBlock"))) (entmake '((0 . "CIRCLE") (10 0 0 0) (40 . 5))) (entmake '((0 . "ENDBLK"))) Now, I want to modify "myBlock" adding a line entity to this block definiton using pure AutoLisp. So that myBlock will contain a circle and a line at the end. Any advice? Quote
BIGAL Posted February 25, 2023 Posted February 25, 2023 Google is your friend, "add entity to block autocad lisp" Quote
Suha Posted February 25, 2023 Author Posted February 25, 2023 I googled before I write here BIGAL. But the samples I met include vla functions however I am an intellicad guy and I seek a solution without vla's. Quote
Steven P Posted February 25, 2023 Posted February 25, 2023 You can go right back to simplest but least efficient methods if you want for example (command "bedit" -blockname-) (entmake '((0 . "LINE") (10 0 0 0)(11 10 10 0) )) (command "bsave") (command "bclose") Quicker than doing it manually..... Though you could just make the line as a part of the block? (entmake '((0 . "BLOCK") (2 . "myBlock"))) (entmake '((0 . "CIRCLE") (10 0 0 0) (40 . 5))) (entmake '((0 . "LINE") (10 0 0 0)(11 10 10 0) )) (entmake '((0 . "ENDBLK"))) Quote
Suha Posted February 25, 2023 Author Posted February 25, 2023 Thanks for the answer Steven P, but my question is to modify by adding /removing the entiti(es). I came up with a solution like this: (defun c:MakeBlock () (entmake '((0 . "BLOCK") (2 . "myBlock"))) (entmake '((0 . "CIRCLE") (10 0 0 0) (40 . 5) (-3 ("AD_INSIDE" (1070 . 0))))) (entmake '((0 . "ENDBLK"))) ) (defun c:AddLineToBlock() (setq head (tblobjname "BLOCK" "myBlock")) (entmake (entget head)) (setq circle (entnext head)) (entmake (entget circle '("*"))) (entmake '((0 . "LINE") (10 0 0 0) (11 15 15 0))) (entmake '((0 . "ENDBLK"))) (command "_REGEN") ) This achieves the solution I seek, but I expected to use (entmod (entget head)). Is this the regular way or is there better way. Quote
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.