×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

AUTOCAD VBA - extacting attribute values

AUTOCAD VBA - extacting attribute values

AUTOCAD VBA - extacting attribute values

(OP)
i'm using the following code to get attribute data:
varAttributes = BlkRefObj.GetAttributes
then using i in a loop:
tag=(varAttributes(i).TagString)
value=(varAttributes(i).TextString)

this works fine for most attributes, but there is a least 1 attribute in a title block that the .textstring property is nothing even though the attribute has a value

anyone know why this only works 99% of the time?

RE: AUTOCAD VBA - extacting attribute values

Are you sure it has a value, or is it just "supposed" to have a value. Did you try edit attributes, and if so, is the text actual there?

RE: AUTOCAD VBA - extacting attribute values

(OP)
I THINK I FOUND THE PART OF PROBLEM:
there are ~20 layouts each with the title block, all of the attributes in question have a value (the block does not have a default value though, like most of the others in the block),anyway, there must be block reference "hiding" in the drawing w/o a value for the attribute. and that was the only one vba was finding.
MY PROBLEM REALLY HAD TO DO WITH:
while iterating through the layouts collection & making each layout active then iterating through the actual title blocks in each layout.
if i go thru .activelayout vba seems to find the same instance of the block 20 times (number of layouts).
if i go thru .paperspace it seems to find the actaul blocks and finds the proper property

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources