Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if user defined/added property exists

Status
Not open for further replies.

JayEnn1

Automotive
Sep 29, 2015
50
US
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 )

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top