标签:get graphic graph weight 获取 set lin 颜色 active
View view = doc.ActiveView;
var filterIds = view.GetFilters();//获取所有过滤器
foreach (ElementId id in filterIds)
{
ParameterFilterElement filter1 = doc.GetElement(id) as ParameterFilterElement;
if (filter1 == null) continue;
if (filter1.IsValidObject)
{
OverrideGraphicSettings ogs = view.GetFilterOverrides(id);//这个对象上就能获取到颜色,线型等属性
if (ogs == null) continue;
}
}
/// <summary>
/// 投影线宽
/// </summary>
/// <param name="ogs"></param>
/// <returns></returns>
public string GetProjectionLineWeight(OverrideGraphicSettings ogs)
{
string lineWeight = "<无替换>";
if (ogs.ProjectionLineWeight != -1) lineWeight = ogs.ProjectionLineWeight.ToString();
return lineWeight;
}
/// <summary>
/// 投影线颜色
/// </summary>
/// <param name="ogs"></param>
/// <returns></returns>
public string GetProjectionLineColor(OverrideGraphicSettings ogs)
{
string lineColor = "<无替换>";
if (ogs.ProjectionLineColor.IsValid)
{
Color rgb = ogs.ProjectionLineColor;
lineColor = " " + rgb.Red.ToString() + ‘ ‘ + rgb.Green.ToString() + ‘ ‘ + rgb.Blue.ToString();
}
return lineColor;
}
/// <summary>
/// 投影线样式
/// </summary>
/// <param name="ogs"></param>
/// <param name="doc"></param>
/// <returns></returns>
public string GetProjectionLinePattern(OverrideGraphicSettings ogs, Document doc)
{
string linePatternName = "<无替换>";
ElementId patternId = ogs.ProjectionLinePatternId;
if (patternId.IntegerValue != -1)
{
if (patternId.IntegerValue == -3000010)
{
linePatternName = "实线";
}
else
{
linePatternName = LinePatternElement.GetLinePattern(doc, patternId).Name;
}
return linePatternName ;
}
标签:get graphic graph weight 获取 set lin 颜色 active
原文地址:https://www.cnblogs.com/370826chen/p/11898629.html