Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm changing the line color of a detail line type within a transaction. The change works correctly, but visually the lines do not change color until engaged in the model space. Does anybody know why this occurs? Very simple code...
public static void ToggleColor(Document doc, System.Drawing.Color color)
{
Category linecat = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines);
CategoryNameMap subcats = linecat.SubCategories;
Category linetype = null;
//Check if we already did this before
foreach (Category line in subcats)
{
if (line.Name == NPLUtil.LineType)
{
linetype = line;
}
}
if (!(linetype == null))
{
Transaction trans = new Transaction(doc, "ChangeColorLine");
trans.Start();
linetype.LineColor = ColorUtil.GetRevitColor(color);
trans.Commit();
}
}
Here's a gif after the transaction is complete.
Solved! Go to Solution.