- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I created a DockPanel panel to add buttons and therefore functions.
In one of the functions I want the user to click to choose a point.
First, here is the code for the panel
public partial class ManagerMainPage : Page, IDisposable, IDockablePaneProvider
{
Action myAction;
ExternalEvent myActionExternalEvent;
#region constructor
public ManagerMainPage()
{
InitializeComponent();
myAction = new Action();
myActionExternalEvent = ExternalEvent.Create(myAction);
}
#endregion
private void ListBoxItem_Action_Selected(object sender, RoutedEventArgs e)
{
myActionExternalEvent.Raise();
}
}
The code of my action
public partial class ManagerMainPage
{
public class Action : IExternalEventHandler
{
public void Execute(UIApplication a)
{
UIDocument uidoc = a.ActiveUIDocument;
Document doc = uidoc.Document;
FamilySymbol FamilySymbol = null;
using (Transaction t = new Transaction(doc, "PickPoint"))
{
Plane plane = Plane.CreateByNormalAndOrigin(doc.ActiveView.ViewDirection, doc.ActiveView.Origin);
// create a sketch plane using Geometry.Plane
t.Start();
SketchPlane sp = SketchPlane.Create(doc, plane);
doc.ActiveView.SketchPlane = sp;
t.Commit();
//blocage ICI dans cette action de selection
XYZ point = uidoc.Selection.PickPoint("Please select point");
//DO SOMETHING
}
return;
}
public string GetName()
{
return "External Event Action";
}
}
}
When selecting a point, Revit freezes completely and displays at the bottom left "Ready" ...
The strangest thing is that if I switch to another window (Windows) and go back to Revit + one click in the window, I can finally click to select the point ... (and the message "Please select a dot "is displayed instead of" Ready "... I do not understand the behavior of Revit in relation to this user action within an external control.
There is surely something that I do not control https://thebuildingcoder.typepad.com/files/external_events_knowledgebase.html
I don't know if it's clear enough but any help would be welcome!
Thank you in advance 😊
I'm french please excuse the mistakes and clumsiness.
Cheers, Samuel Caillet
Solved! Go to Solution.
Developer Advocacy and Support +