Jump to content

Adding block / blocks at selected text / object locations. (Auto Populating?)


Guest Brian_MMC

Recommended Posts

Guest Brian_MMC

I have a hand full of different blocks that I need to show up at the justification point on some selected text. Is it possible to have the block automatically be placed to an item like this? I think anything would be better than adding them one by one around the drawing.

Currently I’m using quick select to pick out the needed text and moving them 1000’ to the right filling in the blocks and moving everything back.

Thank you for your ideas in advance.

Brian,

Link to comment
Share on other sites

You could try this... not extensively tested and kinda bucolic

(defun c:test (/ str bn ss idx tobj)
 (vl-load-com)
 (setq str (getstring T "\nEnter text: ")
   bn (getstring T "\nEnter Block name: ")
   ss (ssget "X" '((0 . "*TEXT")))
   idx 0
   )
 (if (not (tblsearch "BLOCK" bn))
     (princ (strcat "\nBlock " bn " doesn't exist in the drawing"))
 (progn
 (repeat (sslength ss)
   (setq tobj (vlax-ename->vla-object (ssname ss idx)))
   (if
     (= (strcase (vlax-get-property tobj 'Textstring)) (strcase str))
       (vl-cmdf "insert" bn (vlax-get tobj 'InsertionPoint) "" "" "")
     )
   (setq idx (1+ idx))
   )
 )
   )
 (princ)
 )

Link to comment
Share on other sites

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...