
Fri, 06/13/2025 - 18:57
Hey,
I'm making an application where you can import a STEP file, make modifications by removing labels and shapes and then save it back to a STEP file again.
At the moment of saving I'm doing all the required modifications to the document using OCAF. The problem with that is that the original document is then modified. Is there a way to duplicate the document and do the modifications on there?
Fri, 06/13/2025 - 20:04
Hello. Yes, there are a way to clone geometry from one document to another, please check: XCAFDoc_Editor. There are a methods to copy shape to new document. That method do not perform deep copy of data, only make copy of referenes. All shapes still from original.
The other solution - save(write) document to the stream and read it back to the new document.
Best regards, Dmitrii.
Sat, 06/14/2025 - 15:21
Thank you for your reply.
I'd like to make a deep copy to really have a full copy to do my modifications on, so that first solution will probably not work, but thanks for it anyway. I learned something new.
The second solution sounds ideal, but I'm using OpenCascadeJS, where streams do not work, so that's a pity. Do you maybe know of other solutions or maybe I need to change my approach? Please let me know.