Jump to content

Need VBA Code For Block Reference Iteration


Recommended Posts

Posted

Hey,

 

i'm needing a very specific code. I need to know how, while iterating block references, get to know on which layout a given block reference is. For example:

For Each objBlockReference in Thisdrawing.blocks
   'Tell me where this block reference is...
   'By this i say "i don't have the smallest clue on how to do it"...
next bojBlockReference

 

Please i need help on this. I'm trying to develop an auto-numbering drawing box for my company and i got stuck here. I need it to be VBA code, since i have no experience with lisp. Please any comment will be helpful...

Posted

Looks like you are iterating through the block collection, which only contains the block definitions, not the block references.

 

Annoying thing is, I am a LISP guy :(

Posted

I just changed that approach a few minutes ago. Too bad if you can't help any more than that... if you can. I will appreciate it. However thanks for letting me know. If there is anything else you know you think can be helpful, i'll be happy to read it...

Posted

Well, there are two ways you could approach it, iterate through the object collection for each layout, and check for the block name.

 

Or try to create a SelectionSet for each layout, get its 'count' prooperty.

 

Lee

Posted

Have a look under BIGAL i posted previous VBA code to look through blocks and do a title block update but this is global.

 

A couple of problems though when you step through a number of title block sheets you know which one comes next sometimes a layout tab is renamed and pushed in the sequence order.

 

I may be wrong here but if you compare the screen view that you look at versus the order autocad displays the tabs in the sheets could be numbered wrong. Autocad in a lot of situations supplies the table info in the order it was created not by the look. What I am saying is you will probably need to arrange the layout tabs or use a tab name to ensure correct numbering. Other than that it should be possible to renumber the sheets etc .

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