Autodesk.Revit.DB.UnderlayOrientation 是Revit API中表示图纸底图方向的类。图纸底图是在Revit中查看其他视图时可以展示在当前视图下方的一种特殊视图。UnderlayOrientation 可以表示图纸底图相对于当前视图的方向和偏转角度。
UnderlayOrientation 类有以下属性:
HorizontalOrientation 表示图纸底图相对于当前视图的水平方向。可以取以下3个值之一:
Plan 表示图纸底图在当前视图中这是一个平面图Northwest 表示图纸底图在当前视图中被旋转了45度到左上方Northeast 表示图纸底图在当前视图中被旋转了45度到右上方VerticalOrientation 表示图纸底图相对于当前视图的竖直夹角。可以取以下5个值之一:
Top 表示图纸底图在当前视图中从上方平移展示Middle 表示图纸底图在当前视图中从中央平移展示Bottom 表示图纸底图在当前视图中从下方平移展示Manual 表示图纸底图在当前视图中从手动设定的方向平移展示Undefined 表示未定义的方向ManualOrientation 当 VerticalOrientation 被设定为 Manual 时,可以通过该属性获得手动设定的方向。
UnderlayOrientation 类没有公开方法。
// 获取当前视图
View currentView = doc.ActiveView;
// 创建一个图纸底图
var underlay = UnderlayBase.Create(currentView, underlayDoc);
// 创建一个 UnderlayOrientation
var orientation = underlay.UnderlayOrientation;
// 设置水平方向为 "Northwest"
orientation.HorizontalOrientation = UnderlayOrientation.HorizontalAlignments.Northwest;
// 设置竖直方向为 "Manual" 并手动设定方向
orientation.VerticalOrientation = UnderlayOrientation.VerticalAlignments.Manual;
orientation.ManualOrientation = 45;