Jump to content

Recommended Posts

Posted

Hi to everyone my question is:

 

I have created several blocks, some are dynamic blocks in a folder.

I wanted to know if possible, by means of VBA, AutoLISP to create a command that insert in a fast every block that I created.

 

I also have another question ...

In autocad 2008 and autocad 2009 guideline functions give us the possibility to insert textoM or guideline with a block that contains (circle, square, etc)

Can this be done through a menu or toolbar guideline to decide which block we want to insert? I mean, to have several buttons and allows us to insert each guideline with circular block, another block with square, triangle, etc.

Posted

I have created several blocks, some are dynamic blocks in a folder.

I wanted to know if possible, by means of VBA, AutoLISP to create a command that insert in a fast every block that I created.

 

 

This could be achieved through LISP - but each block would need a basepoint to be inserted at ~ would this just be the origin?

Posted

If it is just a "fast block inserter" you are after:

 

(defun c:fstblk (/ *error* vLst oVar file fLst dir)
 (vl-load-com)
 (defun *error* (msg)
   (mapcar 'setvar vLst oVar)
   (if (not (eq msg ""))
     (princ (strcat "<< Error: " (strcase msg) " >>")))
   (princ))
 (setq vLst (list "ATTREQ" "CLAYER" "CMDECHO")
   oVar (mapcar 'getvar vLst))
 (if (not (tblsearch "LAYER" "BLOCKS"))
   (command "-layer" "M" "BLOCKS" ""))
 (if (setq file (getfiled "Select First Block" "C:\\" "dwg" 128))
   (progn
     (setq fLst (vl-directory-files
          (setq dir (vl-filename-directory file)) "*.dwg" 0)
       fLst (mapcar '(lambda (f) (strcat dir "\\" f)) fLst))
     (mapcar 'setvar vLst (list 0 "BLOCKS" 0))
     (foreach x fLst
   (command "-insert" x (list 0 0 0) "" "" ""))
     (setq fLen (length fLst))
     (princ (strcat "<< " (itoa fLen) " Blocks Inserted >>")))
   (princ "\n<!> No File Selected <!>"))
 (*error* "")
 (princ))
     

Hope this helps :)

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