.NET

.NET

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

How to P/Invoke acdbGetCurVportTableRecordId for AutoCAD 2008?

160 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,583
Registered: ‎06-29-2007
Message 2 of 3 (156 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 (147 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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.