.NET

.NET

Reply
Valued Contributor
58 Posts
0 Kudos
Registered: ‎09-03-2012
Post 1 of 5
Accepted Solution

get object Id of the newly created entity.

361 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*
2,140 Posts
253 Kudos
Registered: ‎04-29-2006
Post 2 of 5

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
1,464 Posts
277 Kudos
Registered: ‎04-09-2008
Post 3 of 5

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*
2,140 Posts
253 Kudos
Registered: ‎04-29-2006
Post 4 of 5

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
58 Posts
0 Kudos
Registered: ‎09-03-2012
Post 5 of 5

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