Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone.
I learn an ExternalEvent mechanism by this page. Everything ok, event is work succesfully.
But I want to transfer data in my event. For example, I want to crop 3dview by element after click row in table on form. I want to transfer ElementId in my event, but Raise() method have no arguments.
I solved a problem with public static class: save data to static class in form, and get data from static class in event.
But it is not beautiful, I think it must be another way. Please help.
public static class StaticSelection
{
public static List<ElementId> Ids;
public static string DocTitle = "";
public static double CropSize = 10;
}
private void dataGrid_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
...
StaticSelection.Ids = selectedIds;
StaticSelection.DocTitle = "Document.rvt";
StaticSelection.CropSize = trackBarCropZise.Value;
m_ExEvent.Raise();
}
public class MyEvent : IExternalEventHandler
{
void IExternalEventHandler.Execute(UIApplication app)
{
Document doc = app.ActiveUIDocument.Document;
List<ElementId> ids = StaticSelection.Ids;
app.ActiveUIDocument.Selection.SetElementIds(StaticSelection.Ids);
}
...
}
Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram
Solved! Go to Solution.