chek for correct pick of a polyline

chek for correct pick of a polyline

Anonymous
Not applicable
253 Views
3 Replies
Message 1 of 4

chek for correct pick of a polyline

Anonymous
Not applicable
How can I check that I pick a polyline when I ask for it. I want a loop to reselect if I miss the polyline. Dim lineobj1 as object ThisDrawing.Utility.GetEntity lineObj1, LinePickPnt, "Select Polyline:" Thanks Henrik
0 Likes
254 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
The object's ObjectName property will be "AcadPolyline". Check the help file for more info. -- John Goodfellow irtfnm use john at goodfellowassoc dot com "Henrik" wrote in message news:41aca301_3@newsprd01... > How can I check that I pick a polyline when I ask for it. I want a loop to > reselect if I miss the polyline. > > > > Dim lineobj1 as object > > ThisDrawing.Utility.GetEntity lineObj1, LinePickPnt, "Select Polyline:" > > Thanks Henrik > >
0 Likes
Message 3 of 4

Anonymous
Not applicable
Generally this can be done like this: [code] Option Explicit Function pickPoly() As AcadLWPolyline Dim oEnt As AcadEntity Dim OPoly As AcadLWPolyline Dim vPick As Variant Do While OPoly Is Nothing ThisDrawing.Utility.GetEntity oEnt, vPick, vbCr & "Select polyline: " If TypeOf oEnt Is AcadLWPolyline Then Set OPoly = oEnt Exit Do End If MsgBox "I said Select a POLYLINE, knucklehead!!!!", , "Invalid Selection" Loop Set pickPoly = OPoly End Function Sub test() Dim poly As AcadLWPolyline Set poly = pickPoly End Sub [/code] However, you should include some error checking in case the user presses ESC to exit out. -- Jeff check out www.cadvault.com "Henrik" wrote in message news:41aca301_3@newsprd01... > How can I check that I pick a polyline when I ask for it. I want a loop to > reselect if I miss the polyline. > > > > Dim lineobj1 as object > > ThisDrawing.Utility.GetEntity lineObj1, LinePickPnt, "Select Polyline:" > > Thanks Henrik > >
0 Likes
Message 4 of 4

Mikko
Advocate
Advocate
There are several ways to approach this, here is one.

Dim lineobj As Object
Retry:
acadUtl.GetEntity(lineobjl, BasePt, "Select a PLine")
If lineobj.EntityName <> "AcDbPolyline" Then
GoTo Retry
Else
'do your thing here
End If
Message was edited by: Mikko
0 Likes