Jump to content

Recommended Posts

Posted

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

Posted

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)

  • Thanks 1
Posted
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)

Posted

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.

Posted

Have a look at this example full code attached.Pt num bubble.lsp

 

(if (/= (tblsearch "BLOCK" blkname) NIL)
(PRINC "FOUND")			; block exists
(Make_bubble)
)

 

  • Thanks 1
Posted
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.

  • Thanks 1
Posted
(if 
(tblsearch "BLOCK" blkname)		
(Make_bubble)
(princ "NOT FOUND!")
)

 

  • Thanks 1
Posted

Your both right it should be "not found" its actually not needed to do princ I probably left it in when testing.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...