|
updating the design library tab in the task pane
i have written an add-in for sw 2008 that refreshes the cache for each of the pdmworks enterprise vaults that a user is logged into at the beginning of their solidworks session. upon completion of caching, i set the content manager folders value of the hkcu\software\solidworks\solidworks 2008\extreferences key to the proper path(s) of the vaults that have been refreshed. i want the user to have access to the mil-spec parts in each of the vaults via the design library tab when the sw interface loads completely.
however, when the user interface load is complete, the design library shows the mil-spec part library(s) that were represented in the registry setting prior to my change. this means that a user would have to exit and re-enter sw inorder to access the correct mil-spec parts.
i have tried refreshing the task pane using the api call sldworks.refreshtaskpanecontent as shown in the following code:
'refresh design library view
iswapp.refreshtaskpanecontent()
this returns s_ok, implying that the call has completed successfully. i'm guessing that it is not working correctly since the user interface is not fully loaded at the time of the call?!?
does anyone have a suggestion for making this work?
thanks,
eric
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
your problem is that sw reads the registry upon loading, and by the sounds of it does not reread the registry values until restart, which is usually the case for most programs. that could be wrong though.
the documentation implies that you can use iswapp.refreshtaskpanecontent() to refresh the content of the design library tab. this would entail a re-reading of the registry - if you go to tools\options\filelocations\designlibrary and add a file folder, the interface immediately updates the design library tab to reflect the change.
i am guessing that the interface is leveraging the iswapp.refreshtaskpanecontent() call to update - am i wrong?
thanks,
eric
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
i think i had a similar issue regarding updating the template locations through code that didn't update until restart or something similar but that was a while ago and i am not sure if those settigns are even in the registry i never looked.
i will have a play tomorrow see what i can do
i played around with the iswapp.refreshtaskpanecontent() call today, invoking it after the sw user interface was completely loaded. no dice - it just rearranges the folders of the tree on the design library tab. it doesn't refresh the actual content from the registry. :-(
so i began to wonder how the interface refreshes the tab when you change the file locations through the tools\options\filelocations\designlibrary. i perused the api docs and found the iswapp.activatetaskpane call. it asks for a param from the swtaskpanetab_e with 0 being the swdesignlibrary tab.
i tried this with no good result, but i have to think that if i can find a corresponding call that will allow me to deactivate the tab and then reactivate it with the iswapp.activatetaskpane that i may get the desired result...
any thoughts on how to accomplish deactivation?
thanks,
eric
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
i cannot find any function to deactivate a task pane, only a notification when it does, indicating it is deactivated internally depending on conditions. you may want to shoot an email to api support.
have you tried actually setting the tools options design library paths through the code before the refresh of the taskpane? i don't think you need to write any values to the registry. if they are updated in the options via code then when solidworks exits properly, solidworks will write the proper registry settings.
look for swuserpreferencetoggle_e in the help. it may be there.
jeff
oops - forgot to post that i got this working:
after i set the content manager folders value of the hkcu\software\solidworks\solidworks 2008\extreferences key to the proper path of the vaults that have been refreshed (ended up forcing a single vault per user),
i do the following:
iswapp.setuserpreferencestringvalue(swconst.swuserpreferencestringvalue_e.swfilelocationsdesignlibrary, scurrvault)
'refresh design library view
iswapp.refreshtaskpanecontent()
this forces the design library tab to refresh as desired!
traditional flint ridge greeting:
it's not much of a house, but we've got one heckuva basement!
quick |
|