Access to custom occurrences properties via API

Experimenter
Experimenter

From SolidEdge ST9 there is a possibility to add custom occurrence properties to assemblies - these properties are generaly defined in C:\Program Files\Solid Edge ST9\Preferences\CustomOccurrenceProperty.xml. This works and user has ability to acess them via native SolidEdge UI form.

 

I tried to find any usable API, to access these properties (get/set value) but I haven't been sucessful.

I found only AssemblyDocument.DefaultCustomOccurrenceProperties collection that contains custom occ. properties names. Of course, that is useless for me.

 

Any ideas?

 

4 REPLIES

Re: Access to custom occurrences properties via API

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Tomas,

 

I have not tried this, so I am not certain if this will work or not. First, you can use DefaultCustomOccurrenceProperties to see if they exist in the document or not. If they do not exist, you would need to call LoadCustomOccurrenceProperties to load them into the document. Note that the properties must exist in the custom occurrence properties XML file for them to be valid and recognized, you can't just add a new one through the API.

 

After you have verified the custom properties are present in the document, you would get or set the values for each occurrence using the CustomPropertyValue property on the Occurrence or SubOccurrence object.

 

Hopefully this at least gives you a starting point...

 

Greg

Re: Access to custom occurrences properties via API

Experimenter
Experimenter

Hi Greg,

 

CustomPropertyValue is exactly the property I've been looking for.

And it works as you said (unfortunately, there is no comment in SDK help file to this method, so it is reason why I didn't notice it).

Thak you very much for your help.

 

TomasV

Re: Access to custom occurrences properties via API

Siemens Phenom Siemens Phenom
Siemens Phenom

No problem, glad it helped!

Re: Access to custom occurrences properties via API

Experimenter
Experimenter

Hi, I attempted to assign the Notes custom property value

 

 aOcc.CustomPropertyValue[tmpName] := Value;

 

SE returns an exception  - Catastrphic failure.

 

If I assign a default value to the Notes property,  aOcc.CustomPropertyValue[tmpName] returns that value.

 

So I can read the CustomPropertyValue but get an exception if I attempted to assign it.

 

regards

 

Brian