Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi everyone,
how can I solve this error please help me.
namespace RevitAddin3
{
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
//get input from form
Form1 form = new Form1(commandData);
form.ShowDialog();
string name = form.rnumber;
// get Room Element
RoomFilter filter = new RoomFilter();
FilteredElementCollector collector = new FilteredElementCollector(doc);
IList<Element> rooms = collector.WherePasses(filter).ToElements();
// Get the active view of the current document.
Autodesk.Revit.DB.View view = doc.ActiveView;
if (view is Autodesk.Revit.DB.ViewPlan)
{
foreach (Element e in rooms)
{
if (name == e.Name)
{
uidoc.Selection.SetElementIds(e.Id);
}
}
}
else
{
TaskDialog.Show("View", "Please make Sure Plan View");
return Result.Failed;
}
return Result.Succeeded;
}
}
}
Solved! Go to Solution.