AnsweredAssumed Answered

set/get  cell to equation  in Swtable

Question asked by Yong Ning on Jun 23, 2016
Latest reply on Aug 8, 2017 by Yong Ning

Equation in BOM | SOLIDWORKS Forums  https://forum.solidworks.com/message/641655#comment-641655

 

This code don't use

swTable.set_Text(1, 4, "=\"TOTAL: \" SUM(G2:G11) \"kg\"");

Search key word is " set_Text " in SOLIDWORKS API Help??

help ,in Solidworks 2012 API , result is not found?

 

 

pastedImage_0.png

in Swolidworks 2012 API,follow code ,don't set/get cell Equation.

 

 

Private Sub ll()

    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

        Set SwApp = Application.SldWorks

        Set SwModel = SwApp.ActiveDoc

    Dim SwSelMgr As SelectionMgr

        Set SwSelMgr = SwModel.SelectionManager

    Dim SwTabAnn As TableAnnotation, Str

    Dim SwBomTab As BomTableAnnotation

        Set SwBomTab = SwSelMgr.GetSelectedObject5(1)

        Set SwTabAnn = SwBomTab

            With SwTabAnn

                For jj = 0 To .ColumnCount - 1

                       Debug.Print .GetColumnTitle(jj),

                       Debug.Print .Text(.RowCount - 1, jj)

                Next jj

            End With

End Sub

 

''''

Private Sub ll()

    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

         Set SwApp = Application.SldWorks

         Set SwModel = SwApp.ActiveDoc

    Dim SwSelMgr As SelectionMgr

         Set SwSelMgr = SwModel.SelectionManager

    Dim SwView As View

         Set SwView = SwSelMgr.GetSelectedObject5(1)

         Debug.Print SwView.Name

    Dim swBOMTab As BomTableAnnotation, BomPath

         BomPath = "E:\SldDrt\PlateMaterial.sldbomtbt"

         Set swBOMTab = SwView.InsertBomTable2(False, 0.2, 0.2, swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, swBomType_e.swBomType_Indented, "BEM1800-9/25", BomPath)

       

End Sub

 

'''

 

Private Sub ll()
    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2
         Set SwApp = Application.SldWorks
         Set SwModel = SwApp.ActiveDoc
    Dim SwSelMgr As SelectionMgr
         Set SwSelMgr = SwModel.SelectionManager
    Dim SwView As View
         Set SwView = SwSelMgr.GetSelectedObject5(1)
         Debug.Print SwView.Name
    Dim swBOMTab As BomTableAnnotation, BomPath
         BomPath = "E:\SldDrt\PlateMaterial.sldbomtbt"
         Set swBOMTab = SwView.InsertBomTable2(False, 0.415, 0.03, _
            swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_BottomRight, _
            swBomType_e.swBomType_TopLevelOnly, _
            SwView.ReferencedConfiguration, _
            BomPath)
Debug.Print SwView.ReferencedConfiguration
            '"BEM1800-9/25", _
            BomPath)
       
End Sub

Outcomes