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

    .NET

    Reply
    Contributor
    Posts: 13
    Registered: ‎06-09-2009

    How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

    110 Views, 2 Replies
    01-08-2012 08:59 AM
            [DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acdbGetCurVportTableRecordId@@YA?AVAcDbObjectId@@PAVAcDbDatabase@@@Z")]
            private extern static ObjectId acdbGetCurVportTableRecordId(IntPtr dbObject);
            public static ObjectId CurrentViewportTableRecordId(this Database db)
            {
                return acdbGetCurVportTableRecordId(db.UnmanagedObject);
            }

    When i call the CurrentViewportTableRecordId function,I get System.AccessViolationException exception.
    Any help?

    Please use plain text.
    *Expert Elite*
    Posts: 6,635
    Registered: ‎06-29-2007

    Re: How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

    01-08-2012 09:50 AM in reply to: csharpbird

    Hi,

     

    why do you use invoking for that? Looking into the object-browser I found (for 17.1):

    Public ReadOnly Property CurrentViewportObjectId() As Autodesk.AutoCAD.DatabaseServices.ObjectId
         Member von Autodesk.AutoCAD.EditorInput.Editor

     

    Is that also ok? :smileywink:

     

    - alfred -

    -------------------------------------------------------------------------
    Alfred NESWADBA
    Ingenieur Studio HOLLAUS ... www.hollaus.at
    -------------------------------------------------------------------------
    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎06-09-2009

    Re: How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

    01-08-2012 05:05 PM in reply to: alfred.neswadba

    Thanks for your reply.

    But it seems that you cannot P/Invoke the functions wich return an ObjectId value.

    Please use plain text.