How to disable reference of all sketch lines by vba

How to disable reference of all sketch lines by vba

lzs013
Advocate Advocate
439 Views
1 Reply
Message 1 of 2

How to disable reference of all sketch lines by vba

lzs013
Advocate
Advocate

I want to disable reference of all sketch lines by vba. But when the lines created by Project Cut Edges command,  following code doesn't work.

 

 

Sub DisableReference()
'    On Error Resume Next
    Set doc = ThisApplication.ActiveDocument
    Dim oSketch As PlanarSketch
    Set oSketch = ThisApplication.ActiveEditObject
    Dim oLines As SketchLines
    Set oLines = oSketch.SketchLines
    Dim oLine As SketchLine
    For Each oLine In oLines
        oLine.Reference = False
    Next
End Sub

 

 

0 Likes
Accepted solutions (1)
440 Views
1 Reply
Reply (1)
Message 2 of 2

JhoelForshav
Mentor
Mentor
Accepted solution

@lzs013 

Try this:

Sub DisableReference()
    Set doc = ThisApplication.ActiveDocument
    Dim oSketch As PlanarSketch
    Set oSketch = ThisApplication.ActiveEditObject
    Dim oLines As SketchLines
    Set oLines = oSketch.SketchLines
    Dim oLine As SketchLine
    For Each oLine In oLines
    On Error Resume Next
        oLine.Reference = False
    Next
    Dim oProjCut As ProjectedCut
    For Each oProjCut In oSketch.ProjectedCuts
    On Error Resume Next
        oProjCut.BreakLink
    Next
End Sub
0 Likes