ojacomarket Posted April 19, 2020 Posted April 19, 2020 Dear friends, I have a question, could you help with that, please? I have entity data (used entget), which is "Block Reference" -----> (0 . "INSERT") When I download new drawing and use my code to draw objects, which have (0 . "INSERT") the command is executed but object aren't drawn, but when once insert this object into my drawing (which is block reference) the code works perfectly and draws those objects anywhere it needed.. Is it somehow I should deal with dictionaries?? Or which topic of LISP should be covered to deal with those kind of issues Quote
David Bethel Posted April 19, 2020 Posted April 19, 2020 In order to use (entmake) with INSERT, the BLOCK table must contain the referenced INSERT definition. It is not like the command _.INSERT [This also applies to LINETYPE and STYLE and probably others -David ;================== Macros ============================================= (defun SetBlkTbl (n) (if (and (not (tblsearch "BLOCK" n)) (findfile (strcat n ".DWG"))) (progn (command "_.INSERT" n) (command) n)) n) 1 Quote
ojacomarket Posted April 19, 2020 Author Posted April 19, 2020 1 hour ago, David Bethel said: In order to use (entmake) with INSERT, the BLOCK table must contain the referenced INSERT definition. It is not like the command _.INSERT [This also applies to LINETYPE and STYLE and probably others -David ;================== Macros ============================================= (defun SetBlkTbl (n) (if (and (not (tblsearch "BLOCK" n)) (findfile (strcat n ".DWG"))) (progn (command "_.INSERT" n) (command) n)) n) Thank you for the response! What do you is it also possible to get detailed information about block referenced via (vlax-dump-object) , get that data and store in my lisp, does it help me, when I every time open new drawing and try to call that object? does it appear, when I got data from (vlax-dump-object code in my lisp) Quote
Jonathan Handojo Posted April 19, 2020 Posted April 19, 2020 Certainly when you open a new drawing, there's nothing in the block database, so any of the blocks in your LISP code won't work. Quote
BIGAL Posted April 21, 2020 Posted April 21, 2020 Have a look at this example full code attached.Pt num bubble.lsp (if (/= (tblsearch "BLOCK" blkname) NIL) (PRINC "FOUND") ; block exists (Make_bubble) ) 1 Quote
Jonathan Handojo Posted April 21, 2020 Posted April 21, 2020 1 hour ago, BIGAL said: Have a look at this example full code attached.Pt num bubble.lsp (if (/= (tblsearch "BLOCK" blkname) NIL) (PRINC "FOUND") ; block exists (Make_bubble) ) Can be shorten like: (if (tblsearch "BLOCK" blkname) (PRINC "FOUND") ; block exists (Make_bubble) ) As long as the condition to test returns anything other than nil, the "true" expression will be evaluated. 1 Quote
hanhphuc Posted April 21, 2020 Posted April 21, 2020 (if (tblsearch "BLOCK" blkname) (Make_bubble) (princ "NOT FOUND!") ) 1 Quote
BIGAL Posted April 22, 2020 Posted April 22, 2020 Your both right it should be "not found" its actually not needed to do princ I probably left it in when testing. 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.