Author Topic: Set Paperspace Viewport Active  (Read 4070 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
Set Paperspace Viewport Active
« on: August 23, 2006, 12:23:14 AM »
I must be particularly blind today, because I can't see how to set one active. Anyone know how?

Cheers,
Glenn.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Set Paperspace Viewport Active
« Reply #1 on: August 23, 2006, 01:25:59 AM »
Nope, I did find this though in my quick searching routine which may or may not help ->http://discussion.autodesk.com/thread.jspa?messageID=4904423

Like most things with the .net api that aren't exactly clear I ducked into the arx api to see what I could find...and found nada!

good luck!
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Set Paperspace Viewport Active
« Reply #2 on: August 23, 2006, 01:45:38 AM »
I got around it Mick.



Code: [Select]
// Change to Paperspace if not already there...
if (curDb.TileMode)
curDb.TileMode = false;

Editor ed = doc.Editor;
ErrorStatus es = ErrorStatus.OK;
// Are we in a paperspace viewport?
if (curDb.PaperSpaceVportId != ed.CurrentViewportObjectId)
acedPspace();

...and the import:
Code: [Select]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acedPspace@@YA?AW4ErrorStatus@Acad@@XZ")]
private static extern int acedPspace();

I actually wanted to switch to Paperspace and if in any viewports, get out of them. It doesn't appear they wrapped this functionality. A quick look in the '7 docs shows Editor.SwitchToModel and the equivalent for paperspace.

If you wanted to get into a viewport and then change to another I suspect you would have to import acedSetCurrentVPort like so:
Code: [Select]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acedSetCurrentVPort@@YA?AW4ErrorStatus@Acad@@H@Z")]
private static extern int acedSetCurrentVPort(int vpnumber);

You would have to get the viewport number from the viewport you wanted to switch to and pass it into acedSetCurrentVPORT.

This is for anyone else who is trying to do this...end of waffle.

Cheers,
Glenn.