AnsweredAssumed Answered

Looking for API macro for Line Property change

Question asked by Meenakshi Sundar T. on Jul 28, 2017
Latest reply on Aug 1, 2017 by Manikandan Babu

Hi Guys,

I'm Just looking for API macro to change the line property. Kindly provide your suggestions.


Below Program used for changing the Dimension and Note layers


Const ToLayer               As String = "FORMAT"

Sub main()
    Dim swApp                   As SldWorks.SldWorks
    Dim swModel                 As SldWorks.ModelDoc2
    Dim swDraw                  As SldWorks.DrawingDoc
    Dim swView                  As SldWorks.View
    Dim swAnn                   As SldWorks.Annotation
    Dim swDispDim               As SldWorks.DisplayDimension
    Dim NumShts                 As Long
    Dim i                       As Long
    Dim swNote As SldWorks.Note
    Dim swBal As SldWorks.BalloonStack
    Dim swBlock As SldWorks.BlockInstance
    Dim swLine As SldWorks.SketchLine
    Dim swAnnsa As Variant
    Set swApp = CreateObject("SldWorks.Application")
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    NumShts = swDraw.GetSheetCount
    For i = 1 To NumShts
    Next i
    For i = 1 To NumShts
        Set swView = swDraw.GetFirstView
        Set swAnnsa = swView.GetAnnotations(1)
        While Not swView Is Nothing
            Set swDispDim = swView.GetFirstDisplayDimension5
            While Not swDispDim Is Nothing
                Set swAnn = swDispDim.GetAnnotation
                swAnn.Layer = ToLayer
                Debug.Print "Layer is " & swAnn.Layer
                Set swDispDim = swDispDim.GetNext5
            Set swNote = swView.GetFirstNote
            While Not swNote Is Nothing
                Set swAnn = swNote.GetAnnotation
                swAnn.Layer = ToLayer
                Set swNote = swNote.GetNext

            Set swView = swView.GetNextView
    Next i
End Sub