.NET

.NET

Reply
Contributor
waterharbin
Posts: 14
Registered: ‎07-17-2011
Message 1 of 4 (255 Views)

How to use GetObject() to identify an entity's type via this entity's ObjectId?

255 Views, 3 Replies
07-31-2011 07:20 AM

Hello,I don't fully understand what an objetctId is,and how to make good full use of an ObjectId.How to use the GetObject() method.For example,I create a polyline and add this polyline to an ObjectIdcollection.Now,how can I identify this polyline via the ObjectId?

Mentor
SRSDS
Posts: 247
Registered: ‎04-15-2011
Message 2 of 4 (249 Views)

Re: How to use GetObject() to identify an entity's type via this entity's Objec

07-31-2011 07:52 AM in reply to: waterharbin

Try this

 

Dim obj As DBObject = tr.GetObject(ObjId, OpenMode.ForRead)
Dim lwp As Polyline = TryCast(obj, Polyline)
If lwp IsNot Nothing Then
'...
End If

 

Board Manager
StephenPreston
Posts: 372
Registered: ‎05-22-2006
Message 3 of 4 (228 Views)

Re: How to use GetObject() to identify an entity's type via this entity's Objec

08-01-2011 12:28 PM in reply to: SRSDS

Opening an object just to check its object type (to know if you should have opened it) is very time consuming if you're iterating over a large drawing. ObjectId exposes the ObjectClass property so you can check the RXClass of the DbObject the ObjectId is associated with.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Valued Mentor
jeff
Posts: 327
Registered: ‎05-12-2009
Message 4 of 4 (222 Views)

Re: How to use GetObject() to identify an entity's type via this entity's Objec

08-01-2011 02:42 PM in reply to: waterharbin

Look at the arxdoc.chm in the docs folder in the ObjectARX SDK.

 

In the index tab type ObjectID and select about ObjectId structure. It will give you a good explanation.

 

When you create a polyline it's objectId is returned when you use BlockTableRecord.AppendEntity

 

 

 

You can also find your answers @ TheSwamp
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.