TheSwamp

Code Red => .NET => Topic started by: kdub_nz on March 09, 2023, 04:03:41 PM

Title: Error in 'CreateFloatingViewport' help sample
Post by: kdub_nz on March 09, 2023, 04:03:41 PM
in https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-61C22902-F63B-4204-86EC-FA37312D1B6E
Create Paper Space Viewports (.NET)

The Dll Import should be from "accore.dll" NOT from "acad.exe"
and the entry point is incorrect.

The following options work for me in ac2023

Code - C#: [Select]
  1.      //---------------------------------------------------------------------------
  2.       [DllImport("accore.dll", CallingConvention = CallingConvention.Cdecl,
  3.          EntryPoint = "?acedSetCurrentVPort@@YA?AW4ErrorStatus@Acad@@PEBVAcDbViewport@@@Z")]        
  4.       extern static private int acedSetCurrentVPort(IntPtr AcDbVport);
  5.       //---------------------------------------------------------------------------
  6.       [DllImport("accore.dll", CallingConvention = CallingConvention.Cdecl,
  7.          EntryPoint = "?acedSetCurrentVPort@@YA?AW4ErrorStatus@Acad@@H@Z")]
  8.       private static extern int acedSetCurrentVPort(int acDbVportNumber);
  9.       //---------------------------------------------------------------------------
  10.  
  11.  

I imagine there are a few others that have been incorrect for about 9 years or so.

The current Dumpbin output is here:
https://www.theswamp.org/index.php?topic=41527.msg613345#msg613345  if anyone is interested.


live long and prosper.
Title: Re: Error in 'CreateFloatingViewport' help sample
Post by: kdub_nz on March 09, 2023, 07:08:20 PM
Alternate solution from Gilles
and revised code for multiple Viewport creation ( to avoid Acad crash )
https://forums.autodesk.com/t5/net/error-in-createfloatingviewport-help-sample/m-p/11811120/thread-id/76182#M76185