6 Replies Latest reply on Sep 18, 2018 3:58 AM by Martijn Heikens

    Drawing View number occupied

    Martijn Heikens

      When cleaning up drawings i use to rise the numbering of the views logically.

      However occasionally i ran into the message that a view number is occupied although it is not listed in 1 of the sheets.

      Anyone have a clue if this can be solved?

       

      Below an example. For instance Drawing View8 cannot be added (so i added an underscore).

      Drawing View tree.PNG

      When editing to change to "Drawing View8" the following message pops up:

      Drawing View message.PNG

       

      Any help would be appreciated.

        • Re: Drawing View number occupied
          Ryan McCarthy

          Hi Martijn

           

          Bit of a long shot, but have you got that view name in-use by another object anywhere in the drawing?

           

          Can you try clearing all views from the view palette and then trying again?

          Cheers, Ryan

            • Re: Drawing View number occupied
              Martijn Heikens

              Unfortunately to no avail. The field was already empty. I reattached the corresponding part and removed it again, but didn't solve the issue.

              However, what I found out it is indeed the other type of views, in this case several Section Views, which have the number occupied under the hood.

               

              A method I used to rename the views:

              1 Delete the section view which blocks the name (keep in mind that this can be a view on on any of the other sheets as well. For instance, in my case, Section View H-H was holding Drawing View18 occupied)

              2 Rename the view to the desired number.

              3 CTRL-Z to bring back the deleted section view (the renamed view does not change back)

            • Re: Drawing View number occupied
              Deepak Gupta

              Martijn, the solution/option provided by Ryan should wok for you. Can you also suggest if you are renaming the views manually or using a macro?

              • Re: Drawing View number occupied
                Josh Brady

                Martin,

                A little examination under the hood using the API provides some clue here.

                The name you see displayed for section views is not actually the name SolidWorks uses to keep track of them!

                Interestingly enough, SolidWorks actually assigns section views with a good ol' DrawingView[X] number behind the scenes, even though it displays "Section View A-A" in the tree.

                 

                The "Name" property and GetName2 method both seem to return the same value.  However, the help documentation for "GetName2" points to the GetUniqueName method to get the underlying real name for section views.

                 

                If you're really interested to see the actual names of those views, run this little macro from the VBA editor.  It will show you the feature tree name and the real name for every view on the current sheet.  Unfortunately, there's nothing you can do (as far as I can tell) to change the underlying name of the section views.  If you really want your trees to be consistent, you'll have to start intentionally naming every view using an underscore or some other format so that you can avoid trying to overwrite section view "actual" names.

                 

                Dim swApp As Object

                Dim swdwg As SldWorks.DrawingDoc

                Dim swview As SldWorks.View

                Sub main()

                    Set swApp = Application.SldWorks

                    Set swdwg = swApp.ActiveDoc

                    Set swview = swdwg.GetFirstView

                    While Not swview Is Nothing

                        Debug.Print swview.Name, swview.GetName2, swview.GetUniqueName

                        Set swview = swview.GetNextView

                    Wend

                End Sub