VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > Python基础教程 >
  • C#教程之改变填充区域的填充样式

var target = pattern.Target;
var name = pattern.Name;
var fpElem = FillPatternElement.GetFillPatternElementByName(doc, target, name);

using (var tran = new Transaction(doc, "FillPattern"))
{
       tran.Start();
       var selectionIds = app.ActiveUIDocument.Selection.GetElementIds();
       if (selectionIds != null && selectionIds.Any())
       {
            foreach (var id in selectionIds)
            {
                    FilledRegion elem = doc.GetElement(id) as FilledRegion;
                    if (elem != null && !elem.IsMasking)
                    {                                
                          OverrideGraphicSettings overrideGraphicSettings = new OverrideGraphicSettings();
                          overrideGraphicSettings = doc.ActiveView.GetElementOverrides(elem.Id);
                          overrideGraphicSettings.SetProjectionFillPatternId(fpElem.Id);
                          doc.ActiveView.SetElementOverrides(elem.Id, overrideGraphicSettings);
                    }
             }                        
        }
        tran.Commit();
}

相关教程