Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Has anyone encountered an error where retrieving custom properties in an inventor part doesn't work? It only happens on some parts, and only via addins (I'm using C#, but it always works when I run the same script via ilogicVB).
And one way I've found to solve the issue is to basically 'poke' the parameter; so either modify it to a different value then modify it back, or delete the parameter and re-add it. But that solution isn't practical when I have 300+ parts. I've attached the script I use in my addin and ilogic.
Any ideas? Thanks!
Dim propName As String = "PICNumber"
Dim customPropSet As PropertySet
customPropSet = ThisApplication.ActiveDocument.PropertySets.Item("Inventor User Defined Properties")
Try
Dim PIC_Number As Integer = CInt(customPropSet.Item(propName).Value)
Return PIC_Number
Catch
' Property doesn't exist or value isn't valid
Messagebox.show("not working")
End Try
string prop_name = "PICNumber";
PropertySet custom_property_set = part_doc.PropertySets["Inventor User Defined Properties"];
try
{
int PIC_Number = (int)custom_property_set[prop_name].Value;
}
catch
{
System.Windows.Forms.MessageBox.Show("not working");
}
Solved! Go to Solution.