在查看模型的过程中,我们常会用到模型定位,下面我介绍两种模型定位的扩展方法。
快速定位
/// <summary>
/// 快速缩放.
/// </summary>
/// <param name="items">The items.</param>
public static void FastZoom(this IEnumerable<ModelItem> items)
{
Document doc = Application.ActiveDocument;
doc.CurrentSelection.CopyFrom(items);
ComApiBridge.State.ZoomInCurViewOnCurSel();
if (!doc.CurrentSelection.IsEmpty)
doc.CurrentSelection.Clear();
}
平滑定位
/// <summary>
/// 平滑缩放.
/// </summary>
/// <param name="items">The items.</param>
public static void SmoothZoom(this IEnumerable<ModelItem> items)
{
Document doc = Application.ActiveDocument;
doc.CurrentSelection.CopyFrom(items);
Autodesk.Navisworks.Api.Interop.LcRmAutoCAM.OnZoomSelected();
if (!doc.CurrentSelection.IsEmpty)
doc.CurrentSelection.Clear();
}
不同的定位方式会带来不同的效果。