Overriding Linked CAD Layer Lineweight in Drafting View

Ah welcome in the rabbit hole!

Wrong turn / path as it turns out.
layer.SetLineWeight is indeed read only … don’t ask why, don’t know the answer :slight_smile:

BUT we’ll take a few steps back and take another approach (spoiler alert: this one does work; tested myself)

object_styles = revit.doc.Settings.Categories
for cat in object_styles:
    if cat.SubCategories:
        for subcat in cat.SubCategories:
            print subcat.Name
            with revit.Transaction("test"):
                if subcat.Name == "autocad_layer_testname":
                    subcat.SetLineWeight(4, revit.DB.GraphicsStyleType.Projection)

Don’t mind the messy code but basicly I did:

  1. list all the categories in Revit: the linked files are listed there too.
  2. we want the layers of the cad file … in Revit we call them subcategories … so subcategories we will loop.
    SetLineWeight requires an int not a string

Btw: this will set layer lineweights for ALL views.