1. 程式人生 > >C# revit 二次開發 建立線圖案

C# revit 二次開發 建立線圖案

/// <summary>
        /// 建立線型圖案
        /// </summary>
        /// <param name="linePatternName">名稱</param>
        /// <param name="doc"></param>
        /// <returns></returns>
        private LinePatternElement CreateLinePatternElement(string linePatternName, Document doc)
        { 
            List<LinePatternSegment> segments = new List<LinePatternSegment>();
            segments.Add(new LinePatternSegment(LinePatternSegmentType.Dot, 0.1));
            segments.Add(new LinePatternSegment(LinePatternSegmentType.Dash, 0.02));
            segments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.02));
            segments.Add(new LinePatternSegment(LinePatternSegmentType.Dash, 0.02));
            LinePattern linePattern = new LinePattern(linePatternName);
            linePattern.SetSegments(segments);
            LinePatternElement linePatternElement = LinePatternElement.Create(doc, linePattern);
            return linePatternElement;
        }