revit api创建自定义线样式
线型在Revit里有LinePatternElement类来表示。
private LinePatternElement CreateLinePatternElement(string patternName){//Create list of segments which define the line patternList<LinePatternSegment> lstSegments = new List<LinePatternSegment>();lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Dot, 0.0));lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.02));lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Dash, 0.03));lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.02));LinePattern linePattern = new LinePattern(patternName);linePattern.SetSegments(lstSegments);Transaction trans = new Transaction(doc);trans.Start("Create a linepattern element");LinePatternElement linePatternElement = LinePatternElement.Create(doc, linePattern);trans.Commit();return linePatternElement;}
创建线型之后,可以把这个线型赋值给线样式。这里把一个线样式列表中的对象都进行修改线型。
LinePatternElement myLinePatternElement = CreateLinePatternElement("MyLinePattern");foreach (ElementId typeId in lstGridTypeIds){Element gridType = doc.GetElement(typeId);//set the parameter value of End Segment PatternSetParameter("End Segment Pattern", myLinePatternElement.Id, gridType);}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/952337.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!