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
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:
- list all the categories in Revit: the linked files are listed there too.
- 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.