AnsweredAssumed Answered

Get first Bend-Line sketch name (vba)

Question asked by Sébastien Denis on Jan 22, 2020

Hello,

I want to get the name of the 1st sketch (here Bend-lines2) in a drawing in the 1st view in the flat-pattern state of my 1st piece. (already in first sheet, 1rst view and 1rst sheet-metal flat-pattern)

I try to hide/show this sketch but the name is different depending on the piece.

The code when i know the name:

Dim swApp As Object
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("Bend-Lines2@Part1@Drawing View1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.BlankSketch
MsgBox "Bend-Lines sketch hide"
boolstatus = Part.Extension.SelectByID2("Bend-Lines2@Part1@Drawing View1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.UnblankSketch
MsgBox "Bend-Lines sketch show"
End Sub
 

Outcomes