Jump to content

Finding block names in files


richard3009

Recommended Posts

I have 500 autocad files and I wish to pull the border block name from each file, is there a way of doing this automatically

Link to comment
Share on other sites

The fact that you are using LT version may be a problem.

 

Also, there are some unique criteria that qualify a block as border-block? Is the only block inserted in 0, 0 on layout? Or the name follows a certain pattern?

Link to comment
Share on other sites

The blocks are in a layer called SF i have access to Autocad full version so can run routines

Link to comment
Share on other sites

Ok can be done next question in the dwgs are the title blocks in layout tabs and are they named different or do you just get the first one and then next drawing, then output list to say a text file ? Dwgname location blockname.

 

A bit more are all layout tabs identical ie the title block is always at say 0,0 this is important else it will find wrong block or need more code to work out its a title block.

 

Maybe post sample dwg

Link to comment
Share on other sites

The block is in model space a routine that displayed every bloc in each file would do the job as the borders have names that are quite obvious, what Im aiming to to is a find and replace attribute within the borders of 500 drawings, my problem is that the drawings have different block names for the borders in many of the drawings, I just need to know all the names used and then I can target those specific names.

Link to comment
Share on other sites

Here is a start got it from http://www.cadtutor.net/forum/showthread.php?41652-rename-all-blocks-adding-a-letter

 

Bit rough but gives idea replace princ name with write to file etc

 

(vl-load-com)
 (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))
       blocks (vla-get-Blocks acdoc)
       )

(setq dwgname (getvar "dwgname")) ; also need to out put this first 
(ssget "_X" '((0 . "INSERT")))
       (vlax-for b (setq ss (vla-get-ActiveSelectionSet acdoc))
         (setq name (vla-get-name b))
(princ name)
  )


 (princ)

Edited by BIGAL
dwgname
Link to comment
Share on other sites

The block is in model space a routine that displayed every bloc in each file would do the job as the borders have names that are quite obvious, what Im aiming to to is a find and replace attribute within the borders of 500 drawings, my problem is that the drawings have different block names for the borders in many of the drawings, I just need to know all the names used and then I can target those specific names.

 

Perhaps this lisp from Lee would be helpful?

I haven't gotten around to playing with it yet, but one of the seemingly nice

things about it, is that it works without even needing to open the files, which when you are talking

about 500 files, could certainly save you a lot of time. :)

http://www.lee-mac.com/macatt.html

Thanks Lee! :beer:

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