CADenator Posted August 11, 2008 Posted August 11, 2008 Hello, I have 4 blocks which I have made. 3 of the blocks have a single visibility attribute which have 16 possible choices. The final block is similar with only 4 choices (each corresponding to 4 of the 16 visibility state choices of the other blocks). What I want to do is to automate the following task: 1. Open an existing file containing these block references layed out on the model space as required. 2. Select one combination of the visibility states 3. Save the file with a particular file name (indicating which visibility states have been selected) 4. Repeat steps 2 and 3 for the rest of the 16 visibility state combinations This way, rather than maintaining 16 DWG files, if there is a change, I can update the blocks in the original file and then run this automation to update (recreate) all 16 files. Because I am working with multiple files, I decided to go with VBA, not AutoLISP. If this is a bad decision, please tell me. THE PROBLEM No matter how I try to, I can't figure out how to get a handle to/variable for existing objects in the drawing. I know how to create a new line, or even a new block, but the blocks I am dealing with are too complicated (and not maintainable for that matter) to be created in hard code. Sometimes it is possible to find the "block" I am after to manipulate, but this seems to me to be more the object "in the block editor" rather than the copy in the drawing itself (i.e. block reference). How can I find an existing BlockReference object from within a drawing, so that I can manipulate the dynamic block properties I have created? Thanks, Quote
BIGAL Posted August 11, 2008 Posted August 11, 2008 There are a lot of examples here for editing attributes using VBA its very simple to make new code to do change attributes to 1 or multiple blocks here is a quick example to select all blocks the secondary criteria rem out looks for block name SCHEDTEXT FilterDXFCode(0) = 0 FilterDXFVal(0) = "INSERT" 'FilterDXFCode(1) = 2 'FilterDXFVal(1) = "SCHEDTEXT" Set SS = ThisDrawing.SelectionSets.Add("pit1sel") SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal Quote
CADenator Posted August 11, 2008 Author Posted August 11, 2008 There are a lot of examples here for editing attributes using VBA its very simple to make new code to do change attributes to 1 or multiple blocks here is a quick example to select all blocks the secondary criteria rem out looks for block name SCHEDTEXT Thank you for your help. I didn't get what you said right away. Now I have looked up help on filters and selection sets I understand a bit better. Just for future reference, punctuation is our friend FilterDXFCode(0) = 0 FilterDXFVal(0) = "INSERT" I have a question, what does this find? What type of entity is INSERT? Set SS = ThisDrawing.SelectionSets.Add("pit1sel") Also, what is "pit1sel"? Thanks, Quote
CADenator Posted August 12, 2008 Author Posted August 12, 2008 Hello, It seems I have confused myself. When I said attributes before, I didn't mean a text tag that you enter. I meant the selections you can make with a dynamic block reference. How do you change what dynamic selections are made on a dynamic block reference? Thanks, Quote
BIGAL Posted August 13, 2008 Posted August 13, 2008 Just a quick answer to cadenator the insert value is the same as saying look for blocks the pitsel1 is a name I have given to be used for the data list it could be anything the other modules have pitsel2 3 4 etc Quote
Recommended Posts
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.