How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

Anonymous
Not applicable
727 Views
2 Replies
Message 1 of 3

How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

Anonymous
Not applicable
        [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?

0 Likes
728 Views
2 Replies
Replies (2)
Message 2 of 3

Alfred.NESWADBA
Consultant
Consultant

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? 😉

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for your reply.

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

0 Likes