- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Custom iProperty reading on component occurrence causing Inventor Crash?
Hello,
I am facing an Inventor API error while trying to read a custom iProperty from a component occurrence. Has someone experienced a similar issue before on Inventor 2020.3.4?
This is happening both when the Inventor session is shown and hidden.
Inventor API Team and Experts please help
@MjDeck @JelteDeJong @johnsonshiue
Thanks,
Amitabh Mukherjee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This doesn't look like a general issue. Because this part of Inventor API is well tested and used by many users.
Can you provide some minimal dataset where the error occurs?
Try to check what kind of occurrence you have as input. Because this can be some strange type. For example virtual component, weld bead in weldment assembly, iPart/iAssembly instance etc.
BTW please put code sample as text instead of print screen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@Michael.Navara - Exploring the issue with reading iProperties in the case of the tool assembly,
We have found that if the LOD representation is CLEAN, irrespective of inventor session visible or invisible mode, the exception is being reported out for a few occurrences in the assembly. We are trying to list out the specific occurrences where the error is popping out. There are no unresolved parts when the LOD is clean and no out-of-date parts as well.
In the case of LOD representation Master, there is no exception in Inventor
Thanks,
Amitabh Mukherjee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
That's it. Because in LOD some documents are not loaded in memory. In this case you are not able to read anything from this documents.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@Michael.Navara- We are opening the Assembly in "Load Full" mode. Why would some documents be not loaded in CLEAN LOD but loaded in MASTER LOD? Is there a particular API that we can use to check if the AssemblyDocument or PartDocument is loaded?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If something is not loaded because LOD then usually that means that the occurrence is suppressed in the LOD. You can easily check this.
if (compOccurrence.Suppressed)
{
throw new Exception($"{compOccurrence._DisplayName} is suppressed!");
}
Document doc = (Document)compOccurrence.Definition.Document;
PropertySet customPropSet = doc.PropertySets["nventor User Defined Properties"];
try
{
Property iProperty = customPropSet["V_01_PART_TYPE"];
string value = iProperty.Value.ToString();
if (string.IsNullOrEmpty(value) return false;
if (!value.Equals("SINGLE_DETAIL", StringComparison.InvariantCultureIgnoreCase) return false;
return true;
}
catch (Exception)
{
return false;
}
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@JelteDeJong- Really appreciate the updated code.
We did some more digging and found that in the Clean LOD representation, there are missing references which is causing the exception
What I was surprised to see is that we are able to open the iProperty dialog on the Parent node manually but not using code. There must be some use-case that is not properly handled in the Inventor APIs.
Thanks,
Amitabh Mukherjee