• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012
    Accepted Solution

    get object Id of the newly created entity.

    181 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.

    Please use plain text.
    *Expert Elite*
    Posts: 1,647
    Registered: ‎04-29-2006

    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
    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,177
    Registered: ‎04-09-2008

    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

    Please use plain text.
    *Expert Elite*
    Posts: 1,647
    Registered: ‎04-29-2006

    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
    Please use plain text.
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012

    Re : get object Id of the newly created entity.

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

    Thanks All.

    Please use plain text.