Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Line Weight Setting

1 REPLY 1
Reply
Message 1 of 2
drdanielfc
619 Views, 1 Reply

Line Weight Setting

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

1 REPLY 1
Message 2 of 2
BIM.Frankliang
in reply to: drdanielfc

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

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community