Reply
Solved! Go to solution

Access to custom occurrences properties via API

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?

 

3 REPLIES
Solution
Solution
Accepted by topic author TomasV
‎09-08-2016 06:45 AM

Re: Access to custom occurrences properties via API

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

[ Edited ]

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

No problem, glad it helped!