A simple question, in here I'd like to show a message box...
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
// This method is called by Inventor when it loads the addin.
// The AddInSiteObject provides access to the Inventor Application object.
// The FirstTime flag indicates if the addin is loaded for the first time.
// Initialize AddIn members.
m_inventorApplication = addInSiteObject.Application;
// ********************************
// how to put a message box here?
// ********************************
}
...I've tried using the normal Forms.MessageBox.Show stuff but it does not exist in this context. Is there a native Inventor message box function?
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
Solved by JhoelForshav. Go to Solution.
Hi @oransen
Have you tried adding a reference to System.Windows.Forms in your project? 🙂
Jhoel Forshav Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
That does not seem to be available, only Input and Markup
...and...
I wonder what I am missing....
Hi @oransen
You need to add it to your references in your Visual Studio project.
Right-click references in your project and add reference. It should be in a path like:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Windows.Forms.dll
Depending on your .NET-framework.
Jhoel Forshav Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
@JhoelForshav you are right. But usually you need reference to System.Drawing too.
When you insert new form to your project, all required references are added automatically. Unwanted Form1 can be deleted.
@oransen You can use build-in "message box" inventorApp.CommandManager.PromptMessage(...), but its usage is little bit obscure. See API reference for more information.
Advantage of this is when Inventor is in silent mode, this PromptMessage is not displayed and don't block application.
When you use MessageBox, this is displayed always and user MUST close them. This may be a trouble when you run some automatic task without user interaction.
Can't find what you're looking for? Ask the community or share your knowledge.