I have been using a Dynamo script that adds a selected revision to all sheets in a project. It’s powered by a python code that I pinched from Archi-lab years ago. This was working up until Revit 2023 when I was forced to change the python node from IronPython2 to CPython3.
The script is failing at lines 49 and then 53. On line 49 the error I’m getting is "list object has no attribute “add” which I seem to be able to get past if I replace .Add with .append (unsure if this is even a solution). But once I get past that error I am faced with another error on line 53: "No method matches given arguments for SetAdditionalRevisionIds: (<class ‘list’>).
I’m guessing this is related to the changes in Python engines but I’m pretty stumped and hoping somebody can help me troubleshoot. I’m unable to upload the Dynamo script due to being a new user, but I have taken snips of everything needed to replicate the graph. Thank you for your time!
Why not use the zero touch node for this which is in the archi-lab package?
Are you referring to this custom node in the Archi-Lab package?
Perhaps - though if you are in 2023 you’re in the wrong version of Archi-Lab (check that link - your version should end in 23).
I downloaded the Archi-Lab package 2023.213.1523, and found the ‘Add Revisions to Sheet’ node. It’s almost identical to the Python node I posted above, but in 2023 I needed to also install the DynamoIronPython package as well due to the dependency on IronPython2. I’m all set now, was able to get everything working as intended. Thanks for the help!
i have exactly the same question, for Python Node only w/o using any packages, SetAdditionalRevisionIds() only works in IronPython2, not in CPython3, any insight?
Also, identifying an issue without also posting the code, warning, or model to test on adds quite a lot of additional effort to those who might want to help you out. Post what you have tried and I may check into it tomorrow.
just want to use OOTB and Python nodes only to avoid 3rd party packages version etc issues.
Python code is based on sample by TheBIMCoordinator (Dalton Goodwin), attached pls find the script FYI, thanks
Apply a revisons to multiple sheets.dyn (9.5 KB)
This is a data type issue. If you read the error message it tells you what the issue is.
No method matches given arguments for SetAdditionalRevisionIds:(<class ‘list’>)
Checking the documentation for the method SetAdditionalRevisionIds by setting the final line to
OUT = v.SetAdditionalRevisionIds.__doc__ you’ll see this:
Which indicates it want’s a .net Collection of element IDs, not a python list which is what we have. This means you’ll need to build that data type first, and append the items in your list into it. Fortunately you already have the System.Collections.Generic in the imports. I prefer to import just what is needed from System.Collections and using an alias to prevent confusion, using something like
from System.Collections.Generic import List as cList instead, but we can work with your full import.
revList = List[ElementId](revIds) will produce the desired data type; then you can modify your call to set the revision ides to be
v.SetAdditionalRevisionIds(revList) and things should work.
thanks jacob, works great! .doc seems a good debugging method, not like C#, not much choices for Python
inspect.getmembers from the inspect module which is another import, and
dir are all ‘must know’ in my opinion.
right, thanks for the tips
Would you mind posting your working graph? I’d like to compare with what I’m trying to change on my end.
just modify Python node a bit as below:
revIds = List[ElementId](v.GetAdditionalRevisionIds())