Serializing and deserializing a temporary body
Posted: Sat Dec 11, 2021 5:59 am
Hi,
I found this great article on CodeStack (https://www.codestack.net/solidworks-ap ... y-to-file/) on how to serialize a solid SOLIDWORKS body into a binary stream, and then save it to a local hard drive as a .dat file.
However, that article does not address on how to restore that file back into SOLIDWORKS (deserialize). In my macro, I need a following workflow:
1. Get solid bodies from an open part document;
2. Create temporary bodies from them;
3. Perform various geometric operations on these temporary bodies;
4. Save these temporary bodies into .dat files;
5. In another session, restore these temporary bodies back into the same (or different) model.
That last bit is what I can't figure out how to do. Any suggestions?
I found this great article on CodeStack (https://www.codestack.net/solidworks-ap ... y-to-file/) on how to serialize a solid SOLIDWORKS body into a binary stream, and then save it to a local hard drive as a .dat file.
However, that article does not address on how to restore that file back into SOLIDWORKS (deserialize). In my macro, I need a following workflow:
1. Get solid bodies from an open part document;
2. Create temporary bodies from them;
3. Perform various geometric operations on these temporary bodies;
4. Save these temporary bodies into .dat files;
5. In another session, restore these temporary bodies back into the same (or different) model.
That last bit is what I can't figure out how to do. Any suggestions?