.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to get an object ID

2 REPLIES 2
Reply
Message 1 of 3
h.yang
330 Views, 2 Replies

how to get an object ID

i am using vb.net , and i am now trying to obtain the id of a certain selected object.

firstly i will promote a message and ask users to select one object, and later, obtain the ID of this object.

what command or function avalible for me to obtain the ID of a selected object.

2 REPLIES 2
Message 2 of 3
Ajilal.Vijayan
in reply to: h.yang

Message 3 of 3
mzakiralam
in reply to: h.yang

Hi,

you can try below code to get the object id of a selected object.

 

 <CommandMethod("TST")> Public Sub TESTObject()
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        Dim ed As Editor = doc.Editor
        Dim peo As PromptEntityOptions = New PromptEntityOptions(vbLf & "Select an object:")
        Dim per As PromptEntityResult = ed.GetEntity(peo)
        If per.Status <> PromptStatus.OK Then
            Return
        End If
        Dim id As ObjectId = per.ObjectId
        MsgBox(id.ToString)
    End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost