Revit API / WIndows Forms / IExternal Commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Has anyone has success implementing forms into an external command to be read and implemented into a ribbon application? I have the ribbon features, but am having issues between the external command and windows forms. Please see the code below... Any help would be greatly appreciated!!! Thank you.
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.DB.Architecture;
using System.IO;
using System.Windows.Media.Imaging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Project_Button
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void saveFD_FileOk(object sender, CancelEventArgs e)
{
}
private void openFD_FileOk(object sender, CancelEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
saveFD.InitialDirectory = ("C:");
saveFD.Title = "Save Project Template";
saveFD.Filter = "Text Files(*.txt)|*.txt";
saveFD.Filter = "Text Files|*.txt|Word Files|*.doc";
saveFD.ShowDialog();
}
private void button3_Click(object sender, EventArgs e)
{
openFD.InitialDirectory = ("C:");
openFD.Title = "Open Project Template";
openFD.Filter = "Text Files(*.txt)|*.txt";
openFD.Filter = "Text Files|*.txt|Word Files|*.doc";
openFD.ShowDialog();
}
}
}
When I tried adding the external command lines as follows, my entire form became corrupt...
[Transaction(TransactionMode.Automatic)]
[Regeneration(RegenerationOption.Manual)]
public class ProjectButton : IExternalCommand
{
public Result Execute(
Autodesk.Revit.UI.ExternalCommandData commandData,
ref string message,
Autodesk.Revit.DB.ElementSet elements)
{
}
THANKS AGAIN GUYS!!!