调整代码
This commit is contained in:
@@ -83,6 +83,35 @@ public static class DocumentExtensions
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 按名称修改所有过滤器颜色
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="filterName">过滤器名称</param>
|
||||
public static void ModifyFilter(this Document doc, string filterName,Color color)
|
||||
{
|
||||
var templates = doc.OfClass<View>().Cast<View>().Where(v => v.IsTemplate);
|
||||
foreach (var template in templates)
|
||||
{
|
||||
var filters = template.GetFilters();
|
||||
foreach (var id in filters)
|
||||
{
|
||||
var filterElement = doc.GetElement(id);
|
||||
if (filterElement is ParameterFilterElement filter)
|
||||
{
|
||||
if (filter.Name.Contains(filterName))
|
||||
{
|
||||
var ogs = new OverrideGraphicSettings();
|
||||
ogs.SetProjectionLineColor(color);
|
||||
ogs.SetProjectionLineColor(color);
|
||||
ogs.SetProjectionLineColor(color);
|
||||
ogs.SetProjectionLineColor(color);
|
||||
template.SetFilterOverrides(id, ogs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取所有可预览视图ID
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
|
||||
Reference in New Issue
Block a user