Here's another code that allows for the view selection.
I wasn't sure if you wanted to select the view before running the rule, or if you wanted to select the view after running the rule, so I included code for both scenarios, and commented the one out.
Dim oDDoc As DrawingDocument = ThisDrawing.Document
'[for if you want to pre-select the view before running the rule
Dim oView As DrawingView
If oDDoc.SelectSet.Count = 0 Then
MsgBox("Nothing was pre-selected. Exiting.", vbOKOnly, " ")
Exit Sub
Else
If oDDoc.SelectSet.Item(1).Type = ObjectTypeEnum.kDrawingViewObject Then
oView = oDDoc.SelectSet.Item(1)
Else
MsgBox("The selected object is not a Drawing View object." & vbCrLf & _
"Please Select a Drawing View Object, then run again.Exiting.", vbOKOnly, " ")
Exit Sub
End If
End If
']
'[or for selecting the view after you run the rule
'Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View.")
'If oView Is Nothing Then
' oAns = MsgBox("Nothing was selected. Exiting.", vbOKOnly, " ")
' Exit Sub
'End If
']
Dim oScales As New List(Of Double)
oScales.Add(0.01)
oScales.Add(0.1)
oScales.Add(0.25)
oScales.Add(0.5)
oScales.Add(0.75)
oScales.Add(1)
oScales.Add(1.25)
oScales.Add(1.5)
oScales.Add(1.75)
oScales.Add(2)
oScales.Add(10)
Dim oScale As Double = InputListBox("Select Scale.",oScales)
Dim oSketch As DrawingSketch
Dim oHatch As SketchHatchRegion
If oView.Sketches.Count > 0 Then
For Each oSketch In oView.Sketches
oSketch.Edit
For Each oHatch In oSketch.SketchHatchRegions
oHatch.Scale = oScale
Next
oSketch.ExitEdit
Next
Else
MsgBox("There were no sketches within this view.",vbOKOnly," ")
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.
Wesley Crihfield

(Not an Autodesk Employee)