Author Topic: Title block attribute alteration.  (Read 2625 times)

0 Members and 1 Guest are viewing this topic.

jumpy

  • Newt
  • Posts: 70
Title block attribute alteration.
« on: May 11, 2015, 05:16:18 AM »
Hi everyone, I was trawling last week looking for ideas to quickly change title block attribute values, when I came across this augi thread:

http://forums.augi.com/showthread.php?64985-Using-lisp-to-Edit-Attributes-in-a-Title-Block

I have a bunch of drawings in a current job that all need to have an attribute altered. I wasn't fussed about a program that looks at a folders drawings and by some sorcery makes all the title blocks change; rather some nifty lisp that will change an attribute in whatever drawing I have open.

I had an idea for automating the attedit dialog and it turns out I wasn't far off with my reasoning.



In fact rkmcswain's code is just what I wanted:
Code: [Select]
(command "._attedit" "_N" "_N" "Sheet Details-DSA" "WHAT_IS_THE_CURRENT_ISSUE" "*" "#" "1")

However I have encountered an issue I'm hoping the forum can set me right on.
Some of my attribute tags read as follows:

DRAWING_#

SCALE

as examples.

Now the code works just fine for replacing the 'scale' value, but only when I remove the dynamic visibility states from the block.

However it repeatedly prompts an error when looking at the 'drawing_#' tag and value, no matter if the visibility states are removed or not.

Code: [Select]
Command: (command "._attedit"  "_N"        "_N"      "A1 FRAME BLOCK"
(_>    "DRAWING_#"  "*"        "#"      "12345"
(_>   )
._attedit
Edit attributes one at a time? [Yes/No] <Y>: _N
Performing global editing of attribute values.
Edit only attributes visible on screen? [Yes/No] <Y>: _N
Drawing must be regenerated afterwards.
Enter block name specification <*>: A1 FRAME BLOCK
Enter attribute tag specification <*>: DRAWING_#
Enter attribute value specification <*>: *
0 attributes selected.*Invalid*
; error: Function cancelled

The above is typical of the kind of error I'm encountering.
Is this because of the way my attribute tags are named (using special characters), or like the problem with the 'scale' alteration, is this something related to the block having a dynamic visibility state (this is something I don't want to remove).
I think autocad creates 'random' names for dynamic block states (I can't think of a better way to describe it), so I'm thinking that this will stop the code from identifying the attributes some how.

Much obliged for any input on this.
Acad 2018 / LT2018

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Title block attribute alteration.
« Reply #1 on: May 11, 2015, 07:27:19 AM »
Yes it seems the special character is what makes it go all wonky. Notice this uses the same special characters as the selection filters, which are the same as those in the wcmatch function. So you could get around them by placing a reverse single quote in front of the special character. So try this instead:
Code - Auto/Visual Lisp: [Select]
  1. (command "._attedit" "_No" "_No" "A1 FRAME BLOCK" "DRAWING_`#" "*" "#" "12345")


And also yes regarding the dynamic blocks being given some random name. You could get around that my using * for the block-name, but that means it would search through all blocks for those attributes - no biggie if you only have that attribute in the one block, but could give hassles if other blocks also contain an attribute named the same.


Otherwise there's 2 ways to go about trying to work with these "random" names for dynamic blocks:
« Last Edit: May 11, 2015, 07:40:28 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

jumpy

  • Newt
  • Posts: 70
Re: Title block attribute alteration.
« Reply #2 on: May 12, 2015, 09:47:53 AM »
Ah, thanks.  I'd forgotten about ` treating special characters as ordinary.

Using the * to select the block name seems to have worked so far (there is only one block with the named attributes I'll be looking for) - I've used the code to change DRAWING_# and PROJECT_# attributes (but only if the value already contains numbers ie change the existing string 4567 to the new string 1234 - it doesn't seem to work if there's no value to find)

Some background - all of this is a means of fixing a missing part of the scale attribute on my title block. They should read '1:100 @ A0', but for some reason the scale is missing so it only reads '@ A0'.

Unfortunately the code finds the scale attribute but does not change it. However if I enter the attribute in the title block as '1100 @ A0' and run the code it will only change the 1100 part successfully.

I must be running into a problem with the : or I need to tell it to look for a number and letter string specifically...

hehe, so far I think I've spent as much time playing about with this as it would have taken to manually alter all 35 drawing sheets  :-P
Acad 2018 / LT2018

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Title block attribute alteration.
« Reply #3 on: May 12, 2015, 10:02:01 AM »
Unfortunately the code finds the scale attribute but does not change it. However if I enter the attribute in the title block as '1100 @ A0' and run the code it will only change the 1100 part successfully.
Yes, the attedit command is more like a search-and-replace tool. However, using a blank "" instead of "#" for the existing value to search for might just do the trick here. Have a try.


hehe, so far I think I've spent as much time playing about with this as it would have taken to manually alter all 35 drawing sheets  :P
Yeah, I know ... it tends to go like that ... of course next time round you'd get there a lot quicker and actually save some time  ;D
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.