- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
How can I create a IUpdater that triggers when I change a pipe diameter?
I tried this:
TDiamChanger updater = new TDiamChanger(app.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(updater);
ElementClassFilter filter = new ElementClassFilter(typeof(Pipe), true);
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter,
Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_PIPE_OUTER_DIAMETER)));
But it didnt fire.
and this other option:
Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM))
and this:
Element.GetChangeTypeGeometry()
but nothing worked, it didnt fire.
This worked: Element.GetChangeTypeAny(), but I can't start a transaction (looks like in read-only mode), so I cant change the parameter I need.
Some more pieces of my code:
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
class TDiamChanger : IUpdater
{
static AddInId _appId;
UpdaterId _updaterId;
FailureDefinitionId _failureId = null;
public TDiamChanger(AddInId addInId)
{
_appId = addInId;
_updaterId = new UpdaterId(_appId, new Guid("6f453eba-4b9a-40df-b637-eb72a9ebf008"));
_failureId = new FailureDefinitionId(new Guid("33ba8315-e031-493f-af92-4f417b6ccf70"));
FailureDefinition failureDefinition = FailureDefinition.CreateFailureDefinition(_failureId, FailureSeverity.Error, "teste");
}
public void Execute(UpdaterData data)
{
Document doc = data.GetDocument();
using (Transaction t = new Transaction(doc, "Atualizar diametro tubos"))
{
t.Start();
t.Commit();
}
}
public string GetAdditionalInformation()
{
return "";
}
public ChangePriority GetChangePriority()
{
return ChangePriority.MEPSystems;
}
public UpdaterId GetUpdaterId()
{
return _updaterId;
}
public string GetUpdaterName()
{
return "";
}
}
Can someone help me ?
Thanks in advance.
Solved! Go to Solution.