how to check the type of entity selected

how to check the type of entity selected

Anonymous
Not applicable
1,067 Views
3 Replies
Message 1 of 4

how to check the type of entity selected

Anonymous
Not applicable
Hi. is there any way to check the entity selected by NonInteractivePickPoint? iwant to get the ownerid if the item selected is a 3d or 2d vertex. How is it written in vb.net? thanks
0 Likes
1,068 Views
3 Replies
Replies (3)
Message 2 of 4

chiefbraincloud
Collaborator
Collaborator
from the objectid returned by successful selection, use Objectid.ObjectClass.Name

It will return the type name in ARX lingo, which means it will be "AcDb2dVertex", "AcDb3dPolylineVertex", or "AcDbVertex", depending on what kind of vertex it is.
Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 3 of 4

Anonymous
Not applicable
objectid.objectclass does not exist.
Here is my code. im using vb.net by the way.

Dim myDWG As ApplicationServices.Document
Dim myDB As DatabaseServices.Database
Dim myEd As EditorInput.Editor
Dim myFilter(0) As DatabaseServices.TypedValue
Dim myEnt As DatabaseServices.Entity = Nothing
Dim myEnt2 As DatabaseServices.Entity = Nothing


myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
myDB = myDWG.Database
myEd = myDWG.Editor
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = myDWG.TransactionManager

Dim bObject As New EditorInput.PromptNestedEntityOptions("")
Dim opt As EditorInput.PromptPointOptions = New EditorInput.PromptPointOptions("Pick point: ")
bObject.NonInteractivePickPoint = myEd.GetPoint(opt).Value
bObject.UseNonInteractivePickPoint = True

Dim bRes As EditorInput.PromptNestedEntityResult = myEd.GetNestedEntity(bObject)
If bRes.Status = EditorInput.PromptStatus.OK Then
Using ta As Transaction = tm.StartTransaction
myEnt = ta.GetObject(bRes.ObjectId, OpenMode.ForRead)

'myEnt.objectId.objectClass here? myEnt.ObjectId.ObjectClass does not exist...

End Using
End If

Edited by: a7v1n on Apr 9, 2010 12:07 AM Edited by: a7v1n on Apr 9, 2010 12:29 AM
0 Likes
Message 4 of 4

chiefbraincloud
Collaborator
Collaborator

I realize it has been a while since your post, but I just stumbled across this post again while looking for a different one.

 

It has recently been brought to my attention that the ObjectClass property of the ObjectId object was made available in Acad 2009, so if you are (or were) using 2008 or earlier your only option would be to open the object and check it's type.

 

If you have since upgraded your AutoCAD version, or when you do so in the future, the ObjectClass property will be there, and is very handy for type checking things without opening them.

Dave O.                                                                  Sig-Logos32.png
0 Likes