how to open the dialog 'New Project' from my application Visual Basic 2012

how to open the dialog 'New Project' from my application Visual Basic 2012

Anonymous
Not applicable
944 Views
4 Replies
Message 1 of 5

how to open the dialog 'New Project' from my application Visual Basic 2012

Anonymous
Not applicable

Hi, I am developing an application to add design templates in REVIT 2014 using Visual Studio 2012 My question is:
how to open the dialog 'New Project' from my application Visual Basic 2012?

0 Likes
945 Views
4 Replies
Replies (4)
Message 2 of 5

Revitalizer
Advisor
Advisor

Dear marcosmateo,

 

you could just simulate user input by using UIAutomation:

 

http://thebuildingcoder.typepad.com/blog/2011/01/ribbon-spying-and-ui-automation.html

 

There is a method called OpenRevitFile(string filePath) which opens the "Open File" dialog.

The "New Projekt" dialog may be shown in a similar manner.

 

Note that this is an old post, so the internal menu structure may have changed, meaning that you need to adjust the code for your purposes.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 5

Anonymous
Not applicable

Hi Revitalizer

Thanks for answer.

0 Likes
Message 4 of 5

PhillipM
Advocate
Advocate

Or a much tidier way of handling this which is also supported by the Revit API is using the postable command.

 

  formapp.PostCommand(Autodesk.Revit.UI.RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.OpenRevitFile))

 

Cheers

Phillip

Message 5 of 5

Revitalizer
Advisor
Advisor

Dear PhillipM,

 

🙂 of course you are right. The blog post dates from 2011, so it describes an old-fashioned way...

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes