Community
How would I go about setting the Projection Line Weight in "Line Styles" and "Object Styles" using the Revit API?
Hi,
Change Line style can be supported in Revit 2018, you could try codes below:
var linePatternElements = new FilteredElementCollector(doc).OfClass(typeof(LinePatternElement)).ToList(); var categories = doc.Settings.Categories; var lineCat = categories.get_Item(BuiltInCategory.OST_Lines); var subcats = lineCat.SubCategories; Category matchedItem = subcats.get_Item(LineStyleName); matchedItem.SetLineWeight(LineWidth,GraphicsStyleType.Projection); matchedItem.LineColor = new Color(red, green, blue); var linePatternElem = linePatternElements.FirstOrDefault(x => x.Name == LineStyleName); if (linePatternElem != null) { matchedItem.SetLinePatternId(linePatternElem.Id,GraphicsStyleType.Projection); }
Note that codes must run in Transaction 🙂