using Autodesk.Revit.DB;
|
using Autodesk.Revit.DB.Plumbing;
|
using Autodesk.Revit.UI;
|
using System;
|
|
namespace HStation.RevitDev.RevitDataExport.Entity
|
{
|
public class PipeUpdater : IUpdater
|
{
|
public UpdaterId UpdaterId { get; }
|
ExternalEvent_ClosePipeMonitor m_pipeMonitorEvent = null;
|
ExternalEvent m_monitorHandler = null;
|
|
public ElementFilter ElementFilter { get; } = new ElementClassFilter(typeof(Pipe));
|
|
public ChangeType ChangeType { get; } = Element.GetChangeTypeElementAddition();
|
|
public PipeUpdater(string updaterGuid)
|
{
|
UpdaterId = new UpdaterId(Common.GlobalResource.CurrentAddinId, new Guid(updaterGuid));
|
m_pipeMonitorEvent = new ExternalEvent_ClosePipeMonitor();
|
m_monitorHandler = ExternalEvent.Create(m_pipeMonitorEvent);
|
}
|
|
public void Execute(UpdaterData data)
|
{
|
m_monitorHandler.Raise();
|
}
|
|
public string GetAdditionalInformation()
|
{
|
return "PipeUpdater";
|
}
|
|
public ChangePriority GetChangePriority()
|
{
|
return ChangePriority.MEPSystems;
|
}
|
|
public UpdaterId GetUpdaterId()
|
{
|
return UpdaterId;
|
}
|
|
public string GetUpdaterName()
|
{
|
return "PipeUpdater";
|
}
|
|
public void Register()
|
{
|
if (!UpdaterRegistry.IsUpdaterRegistered(UpdaterId))
|
{
|
UpdaterRegistry.RegisterUpdater(this, false);
|
UpdaterRegistry.AddTrigger(UpdaterId, ElementFilter, ChangeType);
|
UpdaterRegistry.AddTrigger(UpdaterId, ElementFilter, ChangeType);
|
}
|
else if (UpdaterRegistry.IsUpdaterEnabled(UpdaterId))
|
{
|
UpdaterRegistry.AddTrigger(UpdaterId, ElementFilter, ChangeType);
|
UpdaterRegistry.AddTrigger(UpdaterId, ElementFilter, ChangeType);
|
}
|
}
|
|
public void RemoveRegister()
|
{
|
UpdaterRegistry.RemoveAllTriggers(UpdaterId);
|
}
|
}
|
}
|