AnsweredAssumed Answered

SWD delete , "MAGNETLINE"

Question asked by Niels Raahauge on Jan 8, 2020
Latest reply on Jan 22, 2020 by Deepak Gupta

I would like to delete all magnetlines on the drawing by a macro, but can not get i working?

 

If I record a macro, and delet a magnetice line the type is TYPE = , "MAGNETLINE"

 

Can sombody help, please.

 

BR Niels

 

'********************Think somthing like this****************************************


Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim i As Integer
Dim CurrCT As SldWorks.Annotation

 Dim myDrawingSheet As SldWorks.Sheet

Sub main()

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc

Set myDrawingSheet = Part.GetCurrentSheet()
Debug.Print "Number of magnetic lines on this sheet: " & myDrawingSheet.GetMagneticLinesCount
Debug.Print
    
Value = instance.GetMagneticLines 'Is this possible?

    If Not Value Is Nothing Then

        For i = 0 To UBound(Value)
            SetCurrCT = Value(i)
            Debug.Print CurrCT.GetName
            boolstatus = Part.Extension.SelectByID2("CurrCT.GetName", "MAGNETLINE", , , 0, False, 0, Nothing, 0)
            Part.EditDelete
        Next i
    End If
     
End Sub

Outcomes