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 )
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 )