Autodesk.Revit.DB.IOnLocalLinkSharedCoordinatesSavedCallback是Revit API中的一个接口,用于在本地链接共享坐标系被保存后触发操作。
public interface IOnLocalLinkSharedCoordinatesSavedCallback
该接口中仅包含一个方法:
void OnLocalLinkSharedCoordinatesSaved(Document document, ElementId linkId)
document
:Type: Document。指向触发共享坐标系保存事件的文档。linkId
:Type: ElementId。指向本地链接元素的ID。该方法没有返回值。
下面是一个使用IOnLocalLinkSharedCoordinatesSavedCallback的示例。
public class LocalLinkSharedCoordinatesSavedEventHandler : IOnLocalLinkSharedCoordinatesSavedCallback
{
public void OnLocalLinkSharedCoordinatesSaved(Document document, ElementId linkId)
{
// 执行操作
}
}
public class MyApplication : IExternalApplication
{
public Result OnStartup(UIControlledApplication application)
{
LocalLinkSharedCoordinatesSavedEventHandler eventHandler = new LocalLinkSharedCoordinatesSavedEventHandler();
application.ControlledApplication.DocumentControl.LocalLinkSharedCoordinatesSaved += new EventHandler<LocalLinkSharedCoordinatesSavedEventArgs>(eventHandler.OnLocalLinkSharedCoordinatesSaved);
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
}
建议在IExternalApplication.OnStartup方法中注册LocalLinkSharedCoordinatesSaved事件,并在IExternalApplication.OnShutdown方法中注销它。