I'm trying to simply show a dialog, here is my code...
[code]
namespace HelloWorld
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)]
public class Class1 : IExternalCommand
{
public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
ref string message, ElementSet elements);
public void ShowMyDialogBox()
{
Form1 frm = new Form1();
frm.ShowDialog();
}
}
}
[/code]
I've started with the HelloWorld sample. The debugger is getting caught on
'Execute' (see attached). Any ideas? Thanks.
I think it is just as it says...you don't have a body for Execute(...). You must have implementation for it because it is declared in IExternalCommand interface which you are inheriting.
Hmmm...it sounds strange that it works with something other.
But what the error refers is the missing function body for Execute().
See Method body
That's strange...let's try again 🙂
(with pure copy-paste)
http://msdn.microsoft.com/en-us/library/aa664437%28v=vs.71%29.aspx
Exectue is a method in class1-- meaning that it should have a method body which is missing .
You are endin the class with a semicolon without immplementation
Please change the code as below and you can call your method here :
public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { // Call to your method ShowMyDialogBox() }
Hope this helps..
i HI have followed that up with...
publicvoid ShowMyDialogBox()
{
Form1 frm = newForm1();
frm.ShowDialog();
}
Is that correct?
Also, how do I use a Code tag here? Thanks.
Hi bthatcher
I'm assuming that you are trying to call a window in the external command.. and Form1 is the name of your window
You can also direclty call these two lines direclty in the External command method
namespace HelloWorld { [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)] public class Class1 : IExternalCommand { public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { Form1 frm = new Form1(); frm.ShowDialog(); } } }
And to answer your Second Query "Also, how do I use a Code tag here? "
In the reply : Please click on the insert Code button and plac your code..
Hope this helps