public static void ActiveViewByName(UIApplication app, string viewname)
{
Document doc = app.ActiveUIDocument.Document;
UIDocument uidoc = app.ActiveUIDocument;
FilteredElementCollector collector
= new FilteredElementCollector(doc)
.OfClass(typeof(View));
foreach (View v in collector)
{
Debug.Assert(null != v,
"never expected a null view to be returned"
+ " from filtered element collector");
// Skip view template here because view
// templates are invisible in project
// browser
if (v.Name == viewname && !v.IsTemplate)
{
uidoc.ActiveView = v;
}
}
}
二次开发视图名切换到对应视图
猜你喜欢
转载自blog.csdn.net/waiting233/article/details/117922495
今日推荐
周排行