Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Launch/Open Revit menus from within API?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
paul.t.macknight
541 Views, 1 Reply

Launch/Open Revit menus from within API?

paul.t.macknight
Advocate
Advocate

Is it possible to launch/open Revit windows, such as the "Modify DWG/DXF Export Setup" window, from within the Revit API? I did some scouring and I'm having a hard time identifying the viability of this option (which is somewhat necessitated by a macro and hopefully future plugin that will allow me to automate exports). Or would it be possible to jury-rig a call to the button push, effectively simulating the actual button push but with code, utilizing the information in the Revit journal files (below)?

 

Jrn.PushButton "Modal , DWG Export , Dialog_Revit_AdrExportPersistentDlg" _
           , "..., Control_Revit_ModifyExportSetup"
  'C 19-Jul-2021 08:52:06.453;   0:< ADialog::doModal start 

 

I plan on making a Windows/Revit event listener to identify what's launching when clicking through the menus to get to this location and if it's even accessible outside of the Revit UI itself, but I don't want to go through the effort if someone has already confirmed the viability, one way or another, of such a task.

 

Otherwise, I could always imitate the particular dialog interface with Forms and go that route, similar to here, but I was hoping to avoid this for better user friendliness (i.e. If they don't match exactly, especially with the Setup selection, users may be less confident it will save and not be saving settings to the correct location).

 

Any insight would be appreciated!

0 Likes

Launch/Open Revit menus from within API?

Is it possible to launch/open Revit windows, such as the "Modify DWG/DXF Export Setup" window, from within the Revit API? I did some scouring and I'm having a hard time identifying the viability of this option (which is somewhat necessitated by a macro and hopefully future plugin that will allow me to automate exports). Or would it be possible to jury-rig a call to the button push, effectively simulating the actual button push but with code, utilizing the information in the Revit journal files (below)?

 

Jrn.PushButton "Modal , DWG Export , Dialog_Revit_AdrExportPersistentDlg" _
           , "..., Control_Revit_ModifyExportSetup"
  'C 19-Jul-2021 08:52:06.453;   0:< ADialog::doModal start 

 

I plan on making a Windows/Revit event listener to identify what's launching when clicking through the menus to get to this location and if it's even accessible outside of the Revit UI itself, but I don't want to go through the effort if someone has already confirmed the viability, one way or another, of such a task.

 

Otherwise, I could always imitate the particular dialog interface with Forms and go that route, similar to here, but I was hoping to avoid this for better user friendliness (i.e. If they don't match exactly, especially with the Setup selection, users may be less confident it will save and not be saving settings to the correct location).

 

Any insight would be appreciated!

Labels (2)
1 REPLY 1
Message 2 of 2

paul.t.macknight
Advocate
Advocate
Accepted solution

I found what I was looking for. By looking for something else that was in the Revit.UI namespace, I just happened to find the RevitCommandId Class. I did some more digging on that tangent, and this is the result:

 

UIDocument uiDoc = ActiveUIDocument;
Document doc = uiDoc.Document;
Autodesk.Revit.ApplicationServices.Application app = doc.Application;
UIApplication uiApp = new UIApplication(app);

uiApp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.ExportOptionsExportSetupsDWGOrDXF));
0 Likes

I found what I was looking for. By looking for something else that was in the Revit.UI namespace, I just happened to find the RevitCommandId Class. I did some more digging on that tangent, and this is the result:

 

UIDocument uiDoc = ActiveUIDocument;
Document doc = uiDoc.Document;
Autodesk.Revit.ApplicationServices.Application app = doc.Application;
UIApplication uiApp = new UIApplication(app);

uiApp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.ExportOptionsExportSetupsDWGOrDXF));

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report