Showing results for 
Search instead for 
Do you mean 
Reply

Determining if an object has asserted values

Hello everyone,

 

I am having difficulty in determining if an object (part, component) has asserted values or not. The method AskWeightProps fills a structure, but none of the members clearly indicate if an object has asserted values or not.

 

If I tried to delete asserted values from an object which do not have asserted values, then an exception is thrown. However, this solution does not work for me because I have to make decisions wether an object has asserted values or not.

 

I haved tried comparing component values against part values to determine if a component has asserted values or not, but this does not work 100%.

 

Does anyone have any experience with this? Any help will be most welcome!

Marc Prosl
NX Software Developer
5 REPLIES

Re: Determining if an object has asserted values

Check the cache_state member of the returned structure. Possible values for this variable are:

  • NoCache - no data available
  • Cached - calculated from geometry or other properties
  • Asserted
  • Unknown
  • Inherited - component data from asserted value in part
  • Implied

You'll probably never see Unknown or Implied (according to the docs). Looks like you are interested in the Asserted and Inherited values.

Re: Determining if an object has asserted values

Hello cowski1,

 

Thank you very much for the prompt reply. I have also come across the information you have provided me in the documentation. This information works well for parts, but for components it can be misleading.

 

If an occurrence has no asserted values (or values whatsoever), it inherits these from its prototype. If I call AskProps on the component, the cache_state returns Asserted (and not Inherited as expected). When I try to delete the asserted values, an exception is thrown saying the component has no asserted values.

 

Perhaps this is a bug in NX10?

Marc Prosl
NX Software Developer

Re: Determining if an object has asserted values

Are the components in the assembly fully loaded? I've seen partial loading cause some unexpected results when working with components.

 

If the components are fully loaded and you get the same results, GTAC should probably take a look.

Re: Determining if an object has asserted values

Thank you for the tip.

 

Unfortunately the cache_state is stubborn and remains as Asserted, regardless if the component is fully loaded or not. It is even Asserted if the component has no asserted values (inheriting the asserted values from the part).

Marc Prosl
NX Software Developer

Re: Determining if an object has asserted values

Have you tried running the "Sample Open C API program : report weight of current assembly" in the solution centre.  I cannot try it since I do not have an advanced assemblies license.  May be try to set the cache_state to zero before calling the askprops method.