I've been working on a few macros to try and utilize the Freeze Bar functionality more efficiently and I've hit another wall with my latest macro. The function of this macro is to basically allow the user to "Update Frozen Features" of a part while in the parent assembly. Note that I have already created an enhancement request (ER 1-18802404405, SPR 1102914) for this feature to be added in a future release as a right mouse click option, but figured I could create a macro as a workaround in the mean time.
Here is the intended workflow of the macro:
- Assembly is open in Solidworks
- User highlights a part in the assembly's design tree
- User runs this macro via keyboard shortcut
- The macro moves the Freeze Bar of the selected part to the top (may already be there if not frozen), rebuilds, and moves the Freeze Bar back to the bottom
The macro I created (attached) seems to work except for moving the freeze bar back to the bottom. I have been able to get the same command to work when ran on the part file itself, but not on a selected part while in it's parent assembly. It will unfreeze it fine, but will not refreeze it. Hopefully it's just a simple mistake in my code, but I can't seem to figure it out. Please help!