0 Replies Latest reply on Mar 25, 2014 10:21 AM by Nazar Chaykin

    GetConfirutaions through BomFeature

    Nazar Chaykin

      Hi!

      I receive configurations through BomFeature in  DataGridView. Tell me please how can I return meaning  from  DataGridView back in SolidWorks to show the BOM table with chosen configurations?

       

      I receive configurations in this way:

       

              Dim swFeatMgr As FeatureManager

              Dim swBomAnn As BomTableAnnotation

              Dim swBomFeat As BomFeature

              Dim anchorType As Long

              Dim bomType As Long

              Dim configuration As String

              Dim tableTemplate As String

              Dim Names As Object

              Dim visible As Object = Nothing

              Dim boolStatus As Boolean

       

              swFeatMgr = swModel.FeatureManager

       

              boolStatus = swModel.Extension.SetUserPreferenceString(swUserPreferenceStringValue_e.swDetailingLayer, swUserPreferenceOption_e.swDetailingBillOfMaterial, "")

       

              boolStatus = swmodel.Extension.SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, 0, False)

       

              'Select View

              swmodel.ClearSelection2(True)

              swView = swDraw.GetCurrentSheet.GetViews()(0)

       

              'Insert BOM Table

              anchorType = swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft

              bomType = swBomType_e.swBomType_TopLevelOnly

              configuration = swView.ReferencedConfiguration

       

              swmodel.ClearSelection2(True)

       

              tableTemplate = "C:\Program Files\SW-Complex\Template.sldbomtbt"

              swBomAnn = swView.InsertBomTable2(False, -0, -0, anchorType, bomType, configuration, tableTemplate)

              swBomFeat = swBomAnn.BomFeature

       

              Names = swBomFeat.GetConfigurations(False, visible)

              visible(0) = True

              boolStatus = swBomFeat.SetConfigurations(True, visible, Names)

       

              swFeatMgr.UpdateFeatureTree()

       

              ' insert configuration in DTG

       

              For i = 0 To UBound(Names)

                  DataGridConfig.Rows.Add(boolStatus, Names(i))

              Next i