Message 1 of 6
find the total number of lines with an angle equal to a selected line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody.
In a drawing I want to find the total number of lines with an angle equal to a selected line.
I tried this way.
Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
Dim Dwg_Doc As Document = Application.DocumentManager.MdiActiveDocument
Dim Dwg_Db As Database = Dwg_Doc.Database
Dim Dwg_Editor As Editor = Dwg_Doc.Editor
Dim Line As Line
Dim Angle_Line As Double
Dim Sel_Line As PromptEntityResult = Dwg_Editor.GetEntity("Select the line: ")
Using Trans As Transaction = Dwg_Db.TransactionManager.StartTransaction()
Line = Sel_Line.ObjectId.GetObject(OpenMode.ForRead)
Angle_Line = Linea.Angle
End Using
Dim Elenco_Filtri() As TypedValue = New TypedValue() {
New TypedValue(DxfCode.Start, "LINE"),
New TypedValue(DxfCode.Operator, "="),
New TypedValue(DxfCode.Angle, Angle_Line)
}
Dim Linee_Filtrate_Sel As SelectionFilter = New SelectionFilter(Elenco_Filtri)
Dim Linee_Filtrate As PromptSelectionResult = Dwg_Editor.SelectAll(Linee_Filtrate_Sel)
MsgBox("Number line: " & Linee_Filtrate.Value.Count.ToString)
End Sub
This exception is thrown:
"System.NullReferenceException: Reference to an object not set to an object instance.
Autodesk.AutoCAD.EditorInput.PromptSelectionResult.Value.get returned Nothing. "
Where do you think I'm wrong?
Thanks a lot, bye.