Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone 🙂
I´ve got a strange problem with one of my forms / objects. I have a simple button in a modeless form. From this Form I raise an event.
void Button2Click(object sender, EventArgs e)
{
Button s = sender as Button;
SD_SetParameter.value = s.Text;
eventChangeValuesEventhandler.Raise();
}
In this test case, I just wish to change a simple parameter.
When I select a wall or another (system?) family it works fine. It changes the value with the click of the button.
When I select a custom (Generic Model) the thread seems to be blocked. I perform the click, and the command is run AFTER I deselect the element.
For this reason, I cannot do "live" changes to custom families. Do you have an idea on how to solve this issue or am I doing something completely wrong?
Thanks for your support 🙂
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInId("892B06EC-0E66-40F0-B504-21FDAB4BD192")]
public class SD_SetParameter : IExternalEventHandler //this is the last when one making a checklist change, EE4 must be just for when an element is new
{
public void Execute(UIApplication a)
{
try
{
//Document doc = a.ActiveUIDocument.Document;
UIDocument uidoc = a.ActiveUIDocument;
if (uidoc == null)
{
return;
}
Document doc = uidoc.Document;
ICollection<Autodesk.Revit.DB.ElementId> selection = uidoc.Selection.GetElementIds();
using (Transaction t = new Transaction(doc, "Set Parameter"))
{
t.Start("Set Parameters");
foreach (ElementId id in selection)
{
Autodesk.Revit.DB.Element e = doc.GetElement(id);
Parameter p = e.LookupParameter("Kommentare");
if (p != null)
{
p.Set("Test");
}
}
t.Commit();
}
}
catch (Exception ex)
{
TaskDialog.Show("Catch", "Failed due to:" + Environment.NewLine + ex.Message);
}
finally
{
}
}
public string GetName()
{
return "External Event Example";
}
}
Solved! Go to Solution.