Author Topic: Active Document  (Read 1758 times)

0 Members and 1 Guest are viewing this topic.

Arizona

  • Guest
Active Document
« on: April 04, 2012, 12:35:08 PM »
I am trying to run a batch process from an empty drawing (drawing1.dwg). When the first file opens, drawing1.dwg still seems to be the active document. how do I make the file being opened the active document using C#?

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Active Document
« Reply #1 on: April 04, 2012, 12:51:27 PM »
DocumentManager.MDIActiveDocument

DocumentCollection acDocMgr = Application.DocumentManager;
Document acDoc = acDocMgr.Open(strTemplatePath, false);
acDocMgr.MdiActiveDocument = acDoc;
Revit 2019, AMEP 2019 64bit Win 10

Arizona

  • Guest
Re: Active Document
« Reply #2 on: April 04, 2012, 01:31:22 PM »
Thanks! I'll try that.

TheMaster

  • Guest
Re: Active Document
« Reply #3 on: April 04, 2012, 06:34:55 PM »
I am trying to run a batch process from an empty drawing (drawing1.dwg). When the first file opens, drawing1.dwg still seems to be the active document. how do I make the file being opened the active document using C#?

If you are doing this in a registered command, make sure that you
add CommandFlags.Session to the [CommandMethod] attribute, as
that's the only way you will be able to change the active document
without your code being suspended.

Arizona

  • Guest
Re: Active Document
« Reply #4 on: April 05, 2012, 07:01:35 AM »
Thanks Tony! I remember reading about that. I think I will go read that again. I appreciate the help!

Excellent! Thank you so much! That was exactly what I was running into!
« Last Edit: April 05, 2012, 07:27:04 AM by Arizona »