←  Technical Questions

nanoCAD forum

»

Selecting with mouse drag in VB.NET

Mucip İLBUĞA's Photo Mucip İLBUĞA 08 Jul 2024

Hi,
I can select the one object with below code. Well How can I select more than one objects with draging mouse click?

Dim nesne As AcadEntity
Dim nokta As Object

utilty.GetEntity(nesne, nokta, "Nesneyi seçin")




Regards,
Mucip:)
Quote

Dsw's Photo Dsw 09 Jul 2024

Hi,
the method "GetEntity" is nice to use if you would like to select only one entity, a better solution is to use "SelectionSet" which have more options.

Regards
Rossano Praderi
Quote

Mucip İLBUĞA's Photo Mucip İLBUĞA 09 Jul 2024

Hi,
In which help document can I get information about SelectionSet?

Regards,
Mucip:)
Quote

Mucip İLBUĞA's Photo Mucip İLBUĞA 09 Jul 2024

Hi,
I found solution. ;)

Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
		Dim filterType(0) As Integer
		Dim filterData(0) As Object
		Dim cizgi As AcadEntity
	  
		Try
			ncDoc.SelectionSets("PP1").Delete()
		Catch ex As Exception
		End Try
		filterType(0) = 0
		filterData(0) = "line"
		Dim ssetObj As SelectionSet
		ssetObj = ncDoc.SelectionSets.Add("PP1")

		ssetObj.SelectOnScreen(filterType, filterData)
		If ssetObj.Count < 1 Then
			MsgBox("Hiçbir şey seçilmedi! İşlem sonlanıyor. ", MsgBoxStyle.Critical, "Hata!!")
			Exit Sub
		End If
		Dim lin As AcadLine
		For Each cizgi In ssetObj
			lin = cizgi
			Console.WriteLine(lin.EntityName)
		Next

	End Sub

Regards,
Mucip:)
Quote