Author Topic: Switch from Viewport to Paper  (Read 1450 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Switch from Viewport to Paper
« on: September 12, 2012, 06:14:15 AM »
Hi all.
How can I to switch from Viewport to Paper?

Code - C#: [Select]
  1. Boolean modalSpaceIsCurrent = ((Int16) acad.GetSystemVariable("TILEMODE")) == 1 ? true : false;
  2.  
  3. if (modalSpaceIsCurrent) {
  4.         ed.WriteMessage("Command is canceled - MODEL space is current.\n");
  5.         return;
  6. }
  7. Boolean viewportIsCurrent = !modalSpaceIsCurrent && ((Int16)acad.GetSystemVariable("CVPORT")) != 1 ? true : false;
  8.  
  9. if (viewportIsCurrent) {
  10.         ed.WriteMessage("Go out from Viewport to Paper...\n"); 
  11.         //But it not switched from Viewport to paper:
  12.         ed.SwitchToPaperSpace();                                       
  13. }
  14.  
How can I do it?

Regards

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Switch from Viewport to Paper
« Reply #1 on: September 12, 2012, 06:24:18 AM »
I apologize... I forgot to write transaction.Commit();
Problem is solved.

Moderator, delete it topic, please.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Switch from Viewport to Paper
« Reply #2 on: September 12, 2012, 06:30:37 AM »

Andrey, I'll leave it there if you don't mind.
The post may help someone later.
Can  you post the rectified code, just for completeness please ?

Regards
Kerry
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Switch from Viewport to Paper
« Reply #3 on: September 12, 2012, 07:53:09 AM »
Code - C#: [Select]
  1. Boolean modalSpaceIsCurrent = ((Int16) acad.GetSystemVariable("TILEMODE")) == 1 ? true : false;
  2.  
  3. if (modalSpaceIsCurrent) {
  4.         ed.WriteMessage("Command is canceled - MODEL space is current.\n");
  5.         return;
  6. }
  7. Boolean viewportIsCurrent = !modalSpaceIsCurrent && ((Int16)acad.GetSystemVariable("CVPORT")) != 1 ? true : false;
  8.  
  9. if (viewportIsCurrent) {
  10.         ed.WriteMessage("Go out from Viewport to Paper...\n");         
  11.         ed.SwitchToPaperSpace();                                       
  12. }
  13. ...
  14. //tr - Transaction
  15. tr.Commit();// <- it row need.
  16.