10 Replies Latest reply on Nov 3, 2016 7:09 AM by Paul Mendes

    "Use in bill of materials" checkbox

    Mark Treadwell

      Is there a way to access the "use in bill of materials" checkbox in configuration settings via the API? There don't seem to be any properties of the configuration object that lead in this direction; the discussions at https://forum.solidworks.com/thread/77476 and https://forum.solidworks.com/message/102511 sounded promising but the documented switches don't include the one I'm looking for. Any suggestions would be greatly appreciated!

      Thanks,

      -Mark

        • Re: "Use in bill of materials" checkbox
          Artem Taturevych

          The switch you are looking for is swConfigurationOptions2_e.swConfigOption_UseDescriptionInBOM

           

          so you can use something like this:

           

          swPart.EditConfiguration3 "Default", "Default", "", "", swConfigurationOptions2_e.swConfigOption_UseDescriptionInBOM

          ______________________________________________

          Regards, Artem Taturevych | Snr. Developer | IC3D ANZ

           

          IC3DSteel – New Steel Solution for SolidWorks

          translationXpert – SolidWorks files language translator

          LinkedIn - SolidWorks API Group

            • Re: "Use in bill of materials" checkbox
              Mark Treadwell

              Thanks - I must have seen that when I looked at the autocomplete options under swConfigurationOptions2_e but it didn't click as the correct answer.

              • Re: "Use in bill of materials" checkbox
                Wim Block

                Hi Artem, Hi Mark,

                I'm having the same question as Mark, but don't really understand the solution provided by Artem...

                There is no such thing like a design table parameter to set this checkbox on/off?

                Maybe a short macro to run over the part sot set this checkbox on/off?

                Can u please explain a little to me?

                  • Re: "Use in bill of materials" checkbox
                    Deepak Gupta

                    Try these codes

                     

                    'Demonstrates how to select the active configuration description option "Use in bill of materials"

                    'Preconditions: Active file is a Part/Assy

                     

                    Option Explicit

                    Dim swApp           As SldWorks.SldWorks

                    Dim swModel         As SldWorks.ModelDoc2

                    Dim swConfig        As String

                     

                    Sub main()

                        Set swApp = Application.SldWorks

                        Set swModel = swApp.ActiveDoc

                        swConfig = swModel.GetActiveConfiguration.Name

                       

                        If (swModel Is Nothing) Then

                            MsgBox " Please open a Part/Assy document. "

                            End

                        End If

                       

                         If (swModel.GetType = swDocDRAWING) Then

                            MsgBox " Please open a Part/Assy document. "

                            End

                        End If

                       

                        swModel.EditConfiguration3 swConfig, swConfig, "", "", swConfigurationOptions2_e.swConfigOption_UseDescriptionInBOM

                    End Sub

                      • Re: "Use in bill of materials" checkbox
                        Wim Block

                        Hi Deepak

                        Thanks for you code

                        As I'm very unfamiliar with VBA, but I managed to copy paste your suggestion in right place (I'm good ). Made some Cfg's with design table an ran the macro working.

                        Just for providing you some feedback, I see that the DesTable member get's turned into a regular configuration, which is not a problem at this moment, but it would be more helpful (to me) to turn on the option for 'use in BoM' in all the part (asm?) config's and not just the one active... (I'm not less grateful for your quick and helpful response!)

                        I managed a workaround for my wanted description yesterday by concatenating a custom prp through a DesTable, so there's no further need to invest more of your time in this.

                        If ever needed, maybe we can pick this up again later! thx!