ojacomarket Posted April 19, 2020 Share 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 Link to comment Share on other sites More sharing options...
David Bethel Posted April 19, 2020 Share 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 Link to comment Share on other sites More sharing options...
ojacomarket Posted April 19, 2020 Author Share 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 Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted April 19, 2020 Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted April 21, 2020 Share 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 Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted April 21, 2020 Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted April 21, 2020 Share Posted April 21, 2020 True that's what it will return T Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted April 21, 2020 Share Posted April 21, 2020 (if (tblsearch "BLOCK" blkname) (Make_bubble) (princ "NOT FOUND!") ) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 22, 2020 Share 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 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.