Author Topic: Error in 'CreateFloatingViewport' help sample  (Read 1501 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Error in 'CreateFloatingViewport' help sample
« 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.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: Error in 'CreateFloatingViewport' help sample
« Reply #1 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
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.