Hi,
What I’m doing wrong here?
I want to rename these
Hi @Sujan,
The name of parameter isn’t correct. It’s “Type Name”
You can find all the existing parameters with the node “Element.Parameters”.
You will have an error :
"Warning: Element.SetParameterByName operation failed.
The parameter is read-only. ", so it’s better to use python here :
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
pipingsystemtype = UnwrapElement(IN[0])
names = IN[1]
TransactionManager.Instance.EnsureInTransaction(doc)
for i,j in zip(pipingsystemtype,names):
i.Name = j
TransactionManager.Instance.TransactionTaskDone()
OUT = pipingsystemtype
Hi,
Element.set.Name by Clockwork worked fine for me. I need to Restart the Dynamo if I need to run the script again otherwise it undo previous action. How do I fix that? I’m using Spring.Collector.Current.Selection for selecting elements
Try it with the python script provided above, it works with multiples runs. There is no element binding with python.
You can also use Dynamo Player to run again your graph.
To refresh the selection of the node Springs.Collector.CurrentSelection, you need to switch beetween true and false every time you run again the graph.
He’s been really helpful to us. Thank you for the solution.
I used the above python code and it only applies the first letter on the new name. Any idea why that might be?
Hi @Evan.Pond, your list input into python node is @L2 level? Cheers
Hi @Evan.Pond
I can’t see in your picture if the number of element match with the number it element name, can you show the list IN(0) in the python node ?
Cheers
Thanks for looking at this! Yes 1 in on the In[0]. It is renaming the system but for some reason it’s only using the first character of the string.
With a bit more testing if I use a code block (like the original solution) to add two strings then input, it works. But a code block with one string it doesn’t. By adding to strings am I creating a different type of out put?
Hi @Evan.Pond, great very well, it’s because your String is not @L2 level, but after the List Create became @L2 level like the input IN[0] into python script.
Cheers
Also if you want work with “List@Level” (a feature that allows you to directly select which level of list you want to work with right at the input port of the node) you have to create a custum node from this python or use an existing one from the packages made by developpers.
Cheers
@Alban_de_Chasteigner How would you go about renaming the duct or piping system based on the Mark for the equipment in the system? You would not use a static code block for suffix.