11 Replies Latest reply on Feb 9, 2013 1:53 PM by Deepak Gupta

    Sheet name as a property.

    Jakub Radziwon

      Hi everyone,

      I have problem with drawings in SW. I've set my part and assembly templates to have some properties inside of them, for example property "A". Now, when I am making drwaings from parts/ assemblies this property works with table on my drawing. But I am doing multi-sheet SLDDRW file, so I would like to connect this property "A" with sheet name. So basicaly I would like to have automatic connection, as showed at the picture -> I want text from red box (which is "A" prop) as a name of the sheet. As you can see i tried to write @PRPSHEET{A}, but it doesn't work. Does anyone know how to do so ?

      Best regards,

      Jakub Radziwon


        • Re: Sheet name as a property.
          Peter Farnham

          use :-


          link to property

          select -model in view specified in sheet properties

          scroll down to -SW-Configuration Name(Configuration Name)

          • Re: Sheet name as a property.
            Jakub Radziwon

            There is macro created by Deepak Gupta, which solves my problem :


            Rename All Sheets(Configuration Property).swp ---------------------------------02/08/2013


            ' Description: Macro to rename sheets in the active drawing based on view

            '              referenced specific configuration property


            ' Precondition: An Active drawing with sheets and views. Also make sure part/assembly has the

            '               required specific configuration property.


            ' Postcondition: All sheets will be renamed.


            ' This macro is provided as is.  No claims, support, refund, safety net, or

            ' warranties are expressed or implied.  By using this macro and/or its code in

            ' any way whatsoever, the user and any entities which the user represents,

            ' agree to hold the authors free of any and all liability.  Free distribution

            ' and use of this code in other free works is welcome.  If any portion of

            ' this code is used in other works, credit to the authors must be placed in

            ' that work within a user viewable location (e.g., macro header).  All other

            ' forms of distribution (i.e., not free, fee for delivery, etc) are prohibited

            ' without the expressed written consent by the authors.  Use at your own risk!

            ' ------------------------------------------------------------------------------

            ' Written by: Deepak Gupta (http://gupta9665.wordpress.com/)

            ' ------------------------------------------------------------------------------

            Dim swApp As SldWorks.SldWorks

            Dim swModel As SldWorks.ModelDoc2

            Dim swDraw As SldWorks.ModelDoc2

            Dim swSheet As SldWorks.Sheet

            Dim swModelview2 As Configuration

            Dim ConfigName As String

            Dim vSheets As Variant

            Dim swView As SldWorks.View

            Dim ConfigProperty As String

            Dim i As Integer



            Sub main()

            Set swApp = Application.SldWorks

            Set swDraw = swApp.ActiveDoc





            ' Is a drawing document active?



            If swDraw Is Nothing Then



                swApp.SendMsgToUser2 "A drawing document must be open and the active document.", swMbWarning, swMbOk



                Exit Sub



            End If





            ' Is it a drawing document?



            If swDraw.GetType <> SwConst.swDocDRAWING Then



                swApp.SendMsgToUser2 "A drawing document must be open and the active document.", swMbWarning, swMbOk



                Exit Sub



            End If



                vSheets = swDraw.GetSheetNames

                    For i = 1 To swDraw.GetSheetCount


                    swDraw.ActivateSheet vSheets(i - 1)



            Set swSheet = swDraw.GetCurrentSheet

            Set swView = swDraw.GetFirstView

            Set swView = swView.GetNextView




            Set swModel = swView.ReferencedDocument

            ConfigName = swView.ReferencedConfiguration



            ' Replace Kod with the required configuration property.

            ConfigProperty = swModel.CustomInfo2(ConfigName, "Kod")



            swSheet.SetName ConfigProperty



            Next i



            Set swModel = Nothing




            swDraw.Save2 False


            End Sub