Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.md: keep the macro running #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions solidworks-api/geometry/store-restore-body/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Storing the temp body in the SOLIDWORKS document stream via 3rd par
image: restored-body.png
labels: [3rd party storage,store body,restore body]
---
This VBA example demonstrates how to store the copy of the selected body in the new document's stream and restore and display the body on model opening.
This VBA example demonstrates how to store a copy of a selected body in a new document's stream and restore and display the body on model opening.

Body is serialized and deserialized from the [3rd party storage](/solidworks-api/data-storage/third-party/).

Expand All @@ -24,14 +24,15 @@ Body is serialized and deserialized from the [3rd party storage](/solidworks-api

## Running Macro

* Start the macro from the main module. Note, if you run the macro when form is active in the macro editor - form will be displayed as modal window and will prevent selections and saving
* Start the macro from the main module. Note, if you run the macro when the form is active in the macro editor - the form will be displayed as modal window and will prevent selections and saving
* Open any part document with any geometry
* Select solid body from the tree and click *Store Body* in the user form
* New part document is created and the following message is displayed: *Save this document to store the body in its stream*
* Save this file. When file is saving the body from different part is serialized into the stream of new document and no longer related to the original body.
* Select a solid body from the tree and click *Store Body* in the user form
* A new part document is created and the following message is displayed: *Save this document to store the body in its stream*
* Save this file. When the file is saved, the selected body from the part is serialized into the stream of a new document and no longer related to the original body.
* Once completed, the following message is displayed: *Body is stored to the model stream. Close and reopen the model to restore the body*
* Keep the macro running!
* Now, close all documents and reopen the last saved file. The body is deserialized and displayed. Note, that there is no feature tree in the model.

![Restored body](restored-body.png){ width=350 }

* You can close SOLIDWORKS session and reopen the model. The body will still be loaded. Note, you need to run the macro before opening the model.
* You can close your SOLIDWORKS session, start SolidWorks again. You need to run the macro before opening the saved file again. The body will still be loaded.