Hi All,
Apologies for my complete lack of Python ability…
Short version, could someone help me fix the error;
‘AttributeError: can’t assign to read-only property Name of type ‘Category’’
Any advice gratefully received…
#thanks to Archi-lab & bimorph. Apologies for butchering your code.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
#import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
#import Revit API
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
lineStyle = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines)
lineStyleSubTypes = lineStyle.SubCategories
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
listNames = []
for i in IN[0]:
listNames = lineStyleSubTypes
values = IN[1]
TransactionManager.Instance.EnsureInTransaction(doc)
for i, j in zip(listNames, values):
i.Name = j
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = lineStyleSubTypes
Long version…
I’m trying to manage line style names through Dynamo.
I’ve read extensively through the forum and found the topic here…
http://dynamobim.org/forums/topic/change-line-style-name/
Which advises to use the method here…
http://dynamobim.org/forums/topic/excel-roundtrip-fill-patterns-line-styles-etc/
This is fine, I’ve put it all together, but got stuck at setting the name parameter, seemingly this is failing because Line Styles are a Sub-Category of lines.
I can’t see any nodes which might help, so jumped to Python trying to use the same method as the bimorph node LineStylesAttributes… Unfortunately I am no good at Python
I’ve attached the graph for reference.
Thanks,
Mark
Line Styles.dyn (23.6 KB)