2 Replies Latest reply on Aug 13, 2015 11:04 AM by Jiří Konečný

    Part configuration specific custom properties in drawings

    Jiří Konečný

      How do I access the configuration specific properties of the part view, from a drawing file using VB.

       

      I have acces to active configuration of part, bat i need acess to corect configuration of first drawing view.

       

      Sub main()

      Dim swApp                 As SldWorks.SldWorks

      Dim swModel             As SldWorks.ModelDoc2

      Dim swView                As SldWorks.View

      Dim swRefModel        As SldWorks.ModelDoc2

      Dim PartNo                As String

       

      Set swApp = Application.SldWorks

      Set swModel = swApp.ActiveDoc

      Set swView = swModel.GetFirstView

      Set swView = swView.GetNextView

      Set swRefModel = swView.ReferencedDocument

       

      PartNo = swRefModel.CustomInfo2(swRefModel.ConfigurationManager.ActiveConfiguration.Name, "PartNo")

      End Sub

       

      sorry for my bad english.

       

      thanks for the help.

       

      Jirka (Czech Rep.)

        • Re: Part configuration specific custom properties in drawings
          Ivana Kolin

          anglicky taky moc neumim, ale myslim, ze toto by ti mohlo pomoct.

          ActiveConfiguration je configurace, ktera byla aktivni kdyz jsi naposled ulozil model. Referenced je configurace, kterou pouziva drawing nebo component.

          A zjistuju, ze ani cesky moc neumim, aspon ne to co se tyka solidworks a pocitace vseobecne.

           

          Sub main()
          Dim swApp                 As SldWorks.SldWorks
          Dim swModel             As SldWorks.ModelDoc2
          Dim swView                As SldWorks.View
          Dim swRefModel        As SldWorks.ModelDoc2
          Dim PartNo                As String
          
          
          Dim swCustProp As CustomPropertyManager
          Dim val As String
          Dim valout As String
          Dim bool As Boolean
          
          
          Set swApp = Application.SldWorks
          Set swModel = swApp.ActiveDoc
          Set swView = swModel.GetFirstView
          Set swView = swView.GetNextView
          
          Set swRefModel = swView.ReferencedDocument
          Set swCustProp = swRefModel.Extension.CustomPropertyManager(swView.ReferencedConfiguration)
          bool = swCustProp.Get4("PartNo", False, val, valout)
          PartNo = val
          End Sub