.NET

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

How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

156 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,213
Registered: ‎06-29-2007
Message 2 of 3 (152 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 (143 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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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