Line Weight Setting

Line Weight Setting

Anonymous
Not applicable
730 Views
1 Reply
Message 1 of 2

Line Weight Setting

Anonymous
Not applicable

How would I go about setting the Projection Line Weight in "Line Styles" and "Object Styles" using the Revit API?

0 Likes
731 Views
1 Reply
Reply (1)
Message 2 of 2

BIM.Frankliang
Collaborator
Collaborator

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 🙂

 

名片.png

 

 

 

0 Likes