Read/write Next View Label from API

Does anyone know the property for reading/writing the next view label from the sheet properties window?

I saw this post, but it does not address how to access the next view label value from the API:

I would like to take note of it before loading a drafting standard as it looks like the drafting standard contains the information for both next view label and next datum label despite them being shown on the sheet properties page in the UI.

SolidworksApi macros
Answers 3
CB
CB 2019-04-16 Best Answer

There is no way through the API alone to accomplish this, but I have found some workarounds.

I was able to accomplish this in two ways.

  1. Rename all view labels starting with "A" and storing the character as shown in ( ), then use IModelDocExtension::RunCommand swCommands_e.swCommands_Sheet_Tab_Popup_Properties followed by a series of "SendKeys" commands to utilize "{TAB 4}, the "NxtViewLbl" integer from above, and "{ENTER}"
  2. <p>swModel.Extension.RunCommand swCommands_e.swCommands_Sheet_Tab_Popup_Properties, ""</p><p>SendKeys "{TAB 4}"</p><p>SendKeys "^C" 'ctrl+c to copy value</p><p>SendKeys "{ENTER}"</p><p></p><p>'---run other code here---</p><p></p><p>swModel.Extension.RunCommand swCommands_e.swCommands_Sheet_Tab_Popup_Properties, ""</p><p>SendKeys "{TAB 4}"</p><p>SendKeys "^V" 'ctrl+v to paste value</p><p>SendKeys "{ENTER}"</p><p>SendKeys "{NUMLOCK}" 'may be needed to turn NUMLOCK back on due to bug in VBA</p><p></p><p></p>

The {TAB 4} sends the tab key 4 times, and depending on how many times you run the code, you may or may not need to send the NUMLOCK key.

AL
AL 2019-04-17

Hiee Swme Eng

What is your requirement , means by reading/writing the next view label from API what you want to do?? can you explain briefly your Aim/requirement??

CB
CB 2019-04-17

The requirement seems that since loading the drafting standards resets the "Next view label:" and "Next datum label:" in the sheet properties to "A", any views (section, auxilary, detail, etc) created after the standards are updated are duplicates until you reach the last one that was created before the standards were updated.

​, Another thing I forgot to mention is that I had to add the following case to swView.Type Select case from the link above to accomodate auxiliary views:

<p>Case swDrawingViewTypes_e.swDrawingAuxiliaryView</p><p>    Dim swProjView As SldWorks.ProjectionArrow</p><p>    Set swProjView = swView.GetProjectionArrow</p><p>    Debug.Print swProjView.GetLabel</p><p>    swProjView.SetLabel GetNextName</p><p></p>