.NET

Reply
Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 1 of 5 (350 Views)
Accepted Solution

get object Id of the newly created entity.

350 Views, 4 Replies
12-05-2012 03:27 AM

How can I get the object id of the just created entity.

 acTrans.AddNewlyCreatedDBObject(acPoint, true);
                acTrans.Commit();

Selected the point on the dwg with PromptPointResult result value and added it.

Then I want the objectid of this acPoint, to do my next operation.

 

Please suggest.

If acPoint is database resident object, then acPoint.ObjectId return ObjectId of this object/entity

*Expert Elite*
_gile
Posts: 2,115
Registered: ‎04-29-2006
Message 2 of 5 (341 Views)

Re : get object Id of the newly created entity.

12-05-2012 05:12 AM in reply to: newautocad123

Hi,

 

If you appened this DBPoint to some BlockTableRecord before adding it to the Transaction, the BlocktTableRecord.Appendentity() method returns the ObjectId of the entity.

Gilles Chanteau
Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 3 of 5 (333 Views)

Re: get object Id of the newly created entity.

12-05-2012 06:08 AM in reply to: newautocad123

If acPoint is database resident object, then acPoint.ObjectId return ObjectId of this object/entity


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

*Expert Elite*
_gile
Posts: 2,115
Registered: ‎04-29-2006
Message 4 of 5 (323 Views)

Re : get object Id of the newly created entity.

12-05-2012 06:53 AM in reply to: newautocad123

I'm afraid you're confusing DatabaseServices.DBPoint which is a graphic entity with Geometry.Point3d which is an abstract geometrical object.

 

The first one has an ObjectId affected as soon as it's added to a Databse, IOW appended to a BlockTableRecord (space or block definition)

The second one is the tye returned by PromptPointResult.Value and will never be databse resident nor have an ObjectId. It's only to be used for geometric purposes.

Gilles Chanteau
Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 5 of 5 (292 Views)

Re : get object Id of the newly created entity.

12-05-2012 09:35 PM in reply to: _gile

Thanks All.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!