Message 1 of 13
A script for incrementing a block attribute - n00b to CAD scripting!

Not applicable
10-29-2015
09:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi everyone. I want to write a script for a problem, but I'm not sure how to begin. I'm hoping someone will talk to me; see problem below: I have a dwg (2014) which contains many attributal blocks. Each block has an attribute called "crs number", which is a vertical location tracker, and this needs to be incremented after each row of blocks is completed. So, for example, I place a row of, say, 16 blocks all set to at "crs1", then start a new row, at "crs2" and place, another 16-block row, then start a new row of blocks all on "crs3"....etc.... What I would like is a way to easily increment the "crs #" attribute quickly and simply for edits. I don't know if I need LISP to do this. I can run -attedit_N_N at the command line, enter the block name and attribute tag name. What I want is for a way to tell CAD, "OK, increment c1 to c2, find the next 16 blocks of "block name" and change them to c2, and after 16 instances, increment to c3, and place this attribute in the next 16 blocks of "block name", and continue moving up until crs30. Exit." Not sure how to get started with translating this to a cad script. If anyone can even just point me in the right direction, I'd appreciate it. Thanks ***edit*** I don't want to explode the blocks, because each block has a unique part# that I want to keep.