So I'm experimenting with SWX 2012 before distributing it to my department, and currently toying with the concept of using the new "freeze bar" feature in 2012. At the moment, I have code that will allow me to open a file and freeze all of the features. Unfortunately, The toggle switch in the system options is not behaving the way I would expect. As a general principle of courtesy to the user, I wanted to check if they have the freeze bar enabled, so that the API could turn it off after freezing the features. Then based on that result, toggle it as necessary. But when I did this, the freeze bar was not inserted into the part.
Furthermore, taking the next step, I asked "Well, what if the user was forced to have the freeze bar on?" So I made it so that the API turned on the freeze bar and ignored the user's starting condition, and it still does not freeze the features as expected. All of the values returned in the API debugging stage show that all operations were successful.
I know few users are likely to experiment with this, but please let me know if you have any ideas. It's early enough from release it could be a bug.
Code chunks: (both from a COM addin using VB.NET)
frzStatus = iSwApp.GetUserPreferenceToggle(swUserPreferenceToggle_e.swUserEnableFreezeBar)
If frzStatus = False Then 'toggle if freeze is disabled
iSwApp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swUserEnableFreezeBar, True)
retVal = FeatMgr.EditFreeze(swMoveFreezeBarTo_e.swMoveFreezeBarToEnd, "", True) 'always results in retVal = 0
iSwApp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swUserEnableFreezeBar, False)
Else
retVal = FeatMgr.EditFreeze(swMoveFreezeBarTo_e.swMoveFreezeBarToEnd, "", True) 'always results in retVal = 0
End If
Second try (checks user preference, but does not adhere):
frzStatus = iSwApp.GetUserPreferenceToggle(swUserPreferenceToggle_e.swUserEnableFreezeBar)
If frzStatus = False Then 'toggle freeze on if disabled
iSwApp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swUserEnableFreezeBar, True) 'succeeds
End If
retVal = FeatMgr.EditFreeze(swMoveFreezeBarTo_e.swMoveFreezeBarToEnd, "", True) 'returns 0, but does not move
SolidworksApi macros