×
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

Detecting if user defined/added property exists

Detecting if user defined/added property exists

Detecting if user defined/added property exists

(OP)
Good morning!

Can someone help me with a code snippet. I have a renaming macro that loops thru a design
and does a lot of time saving stuff. One of the things it does is to auto-fill user defined
properties.

The problem I am running into is if a designer downloads a CAD file from the internet and
puts it into their design and forgets to define/add user properties the script will bail
because it cannot assign a value to a property that doesn't exist with that Catpart.

How do I look at a CatPart and see if a user property exists?
I did try this
If TmpObject.ReferenceProduct.UserRefProperties.Item("Det").Value <> "" then
... assign value
end if
but it didn't work. Macro still bailed.

Here are a couple lines from the macro which assign values to existing properties.
TmpObject.ReferenceProduct.UserRefProperties.Item("Det").Value = Mid( NewPartNum,6,2 )
TmpObject.ReferenceProduct.UserRefProperties.Item("Shn/Opp").Value = "CENTERLINE"
TmpObject.ReferenceProduct.UserRefProperties.Item("Sub Mod").Value = Left( NewPartNum,3)&Mid( NewPartNum,9,2 )

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