.NET

Reply
Contributor
csharpbird
Posts: 13
Registered: ‎06-09-2009
Message 1 of 3 (153 Views)

How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

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

*Expert Elite*
Alfred.NESWADBA
Posts: 9,070
Registered: ‎06-29-2007
Message 2 of 3 (149 Views)

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
-------------------------------------------------------------------------
Contributor
csharpbird
Posts: 13
Registered: ‎06-09-2009
Message 3 of 3 (140 Views)

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.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.