How to save 3rdPartyStorageData in configuration specific?
How to save 3rdPartyStorageData in configuration specific?
Hi Oleg,
The 3rd party storage is a file level. So you have to implement the configuration levels yourself. The best would be to store the configuration data in the storage stores streams. And name the streams something like Config[ConfigId]. In this case you will be able to quickly access required configuration data without the need to serialize/deserialize complete structure. You won't be able to access the stream from the SolidWorks API so you have to work with storage APIs (IStorage::OpenStream). You also need to take care about deleting the streams of deleted configurations.
Thanks,
Artem
Hi Artem,
sorrowfully.
Could you explain some more dedails about 2015 SOLIDWORKS API Help - IGet3rdPartyStorageStore Method (IModelDocExtension) ?
What does the "tree of names" in the explanation in help?
Or, could you provide some (maybe fictional) code to save serialized context in StorageStore with "specific configuration" names?
take care about deleting the streams of deleted configurations
This means to catch some event "delete configuration"? And subsequent search serialized data in the file, followed by removal?
Maybe putting List<T> data and while deserializing remove unnecessary, it will not give unique names to Stream and will not be "loss of names."
Hi Oleg,
Here is the sample: #CODE|Storing Data in 3rd Party Storage
This means to catch some event "delete configuration"? And subsequent search serialized data in the file, followed by removal?
Maybe putting List<T> data and while deserializing remove unnecessary, it will not give unique names to Stream and will not be "loss of names."
You can go this way as long as you do not have much data and configurations. But if you have a large amount of data and large number of configuration this will be unnecessary. You can consider stores as folders and streams as text files where your data is written to a text file. if you want to delete one of the streams (file) or modify its content you can do it directly to that file (stream) without the need to rewrite another files. But as the first step this would also work.
Thanks,
Artem
You can use DeleteItemNotifyEventHandler event and swNotifyEntityType_e.swNotifyConfiguration and swNotifyEntityType_e.swNotifyDerivedConfiguration as EntityType parameters.
Hi Artem!
Thanks to you, I realized my class to save data from config specific. It's almost a complete blank.
Сохранение данных в 3rd party storage. Часть 1 | StreamDivision
Hi Oleg,
Here is the sample: #CODE|Storing Data in 3rd Party Storage
You can go this way as long as you do not have much data and configurations. But if you have a large amount of data and large number of configuration this will be unnecessary. You can consider stores as folders and streams as text files where your data is written to a text file. if you want to delete one of the streams (file) or modify its content you can do it directly to that file (stream) without the need to rewrite another files. But as the first step this would also work.
Thanks,
Artem