AnsweredAssumed Answered

How to get view name from BOM?

Question asked by Yong Ning on Jun 30, 2014
Latest reply on Jul 1, 2014 by Yong Ning

Hope get view name from BOM.

but follow code → get sheet name from BOM.

 

 

0.jpg

Folloe code, can get sheet name,but don't get view name

method is SwAnn.Owner

 

 

Sub ll()

  Dim SwApp As SldWorks.SldWorks, SwDraw As DrawingDoc

    Set SwApp = Application.SldWorks

    Set SwDraw = SwApp.ActiveDoc

  Dim SwSelMgr As SelectionMgr, SwView As View, SwSheet As Sheet

    Set SwSelMgr = SwDraw.SelectionManager

  Dim SwBomFeat As BomFeature

    Set SwBomFeat = SwSelMgr.GetSelectedObject5(1)

    Debug.Print SwBomFeat.GetFeature.Name

  Dim SwTabAnn As TableAnnotation, SwAnn As Annotation

    Set SwTabAnn = SwBomFeat.GetTableAnnotations(0)

    Set SwAnn = SwTabAnn.GetAnnotation

    Debug.Print SwAnn.GetName, SwAnn.OwnerType

    Debug.Print SwTabAnn.Title

 

    Set SwSheet = SwAnn.Owner

    Debug.Print SwSheet.GetName

    Debug.Print

 

 

End Sub

 

 

code from

SolidWorks Forums: Get Sheet Name that BOM is on

https://forum.solidworks.com/message/436330#436330

SolidWorks Forums: Macro to delete BOM

https://forum.solidworks.com/message/415225#415225

Attachments

Outcomes