Revit 2019 will not be a supported product very soon (if it isn’t already). The Autodesk support window is Current Version (2023) + 3 years back (2022, 2021, 2020). 2019 is currently in the gray area where you ought to be actively moving those jobs into a newer build. There is no reason to not do this - I haven’t met anyone in my travel who can’t upgrade, just some cranky people who ‘won’t’.
You are right that avoiding packages is causing some added work if not managed well. I’ve got an AU submission heading in today on how to manage that stuff; hopefully that will help change your teams perspective to make things easier for you.
So far, the little switch icon in the python script has worked well for me. The last few that I have shared here have been in Cpython as well. However, there is no “bulk migrate” option that I know of.
I am not too sure about that one. Perhaps @solamour has more info
@leonard.moelders IronPython2 is shipped as a package from Dynamo 2.13 onwards, and there is no expiry date on this package As a user, you can choose to keep using this indefinitely.
Out-of-the-box we are shipping CPython3, because IronLanguages (The team that make IronPython) are no longer releasing security updates to IronPython2, and to date IronPython3 is not yet ready enough for us to integrate. In the future, we’ll look at IronPython3 when it’s ready.
As sol noted the IronPython package lives on with no planned expiration. However it is a security risk to have installed.
Dynamo consumes Iron Python. Iron Python consumes Python 2.7. Python 2.7 is not being maintained, updated, or patched.
So should an exploit needing a security patch come out it won’t follow from the Dynamo team, the IronPython team, or the Python team, and all three would need to do an update in backwards order to resolve. I doubt that the Python team is actively monitoring 2.7 for exploits as it is well retired at this point.
But if you aren’t concerned with the security implications, have at it!
Personally I would drop it as soon as I can; I shudder every time a customer need means I need to put that package in place.
@john_pierson , @solamour and @jacob.small
Thank you guys for your help and deeper insight! I hope my group leader will let us use the 2021 Version soon. Unfortunately she is stubborn regarding this topic. She never wants to use the newest version of any software “bEcaUse tHey aRe noT sTaBle” @jacob.small I would be glad if you could send me a link for that AU submission respectively video
How do I know that a CurrentWorkspace has a .Nodes property? I couldn’t find it in github. I found out how we got to currentWorkspace = […] from this line:
But how do I know that this has the .Nodes Property?
The rest is clear.
You can also use dir(thing) if you want to explore inside of Dynamo too
dir() refers to directory, and you can use anything that exists inside of the Python memory space. For example, dir() will pick up everything that exists, and dir(thing) will explore a thing, while dir(thing.thing) will explore a sub-thing.
The original code was written in IronPython2 which had string.Equals(). You’re writing in CPython3 now which doesn’t have this method. You can just use == instead.
This is quite an old post, but this node would be really usefull for the graph I am making.
Unfortunalty it doens’t seem to work, I get te following message:
I have never used the Python Script node before, so maybe I am just doing it wrong.
I insert the node, right click edit, then replace all the code with the code from your post.
Is this the right way to do it? If so, what else could be wrong? Everything should be up-to-date and I am using C3d and dynamo version 2024.
Somehow missed this post back in 2022, such a great find.
Just wanted to add where I think this method is super powerful in a large workflow.
Some of the larger scripts that I have made which are shipped to the whole company via Dynamo player contain a lot of constituent parts. Via a UI the users often are given optional inputs for which parts of the script they wish to run on their model.
To satisfy my desire to have a completed script with no “run with errors” message in the Player, I often found myself developing contrived methods for passing empty lists or nulls (mostly, loads of "Function Apply nodes) where certain portions of the script are not selected to be run by the user.
Your method would give a really neat way of freezing entire portions of a script, expediting my error-catching process and doing away with that annoying yellow text that makes users think something went wrong.
Of course, this could be a thing of the past if we get the ability to run scripts from within scripts as @solamour has alluded to but for now, I’m deffo going to have a look into this.
This code should work
Also did a bit of refactoring and added some additional checks
Can I suggest with old threads it is better to start a new post and link to the old thread
# Original Revit version by Nick Boyts
# https://forum.dynamobim.com/t/executing-one-branch-at-a-time/74991
# Code has been updated/modified by Brendan Cassidy(@brencass86) to work with Civil 3d
import clr
clr.AddReference('AcDynamo')
from Autodesk.AutoCAD import DynamoApp
#access to the current Dynamo instance and workspace
dynamoCivil = DynamoApp.AcDynamoRuntime.DynamoModel
currentWorkspace = dynamoCivil.CurrentWorkspace
#node dictionary
node_dict = {i.Name: i for i in currentWorkspace.Nodes}
#freeze/unfreeze branch nodes
if "Branch 1" in node_dict and "Branch 2" in node_dict:
if IN[0]:
node_dict.get("Branch 1").IsFrozen = False
node_dict.get("Branch 2").IsFrozen = True
out = "Running Branch 1."
else:
node_dict.get("Branch 1").IsFrozen = True
node_dict.get("Branch 2").IsFrozen = False
out = "Running Branch 2."
else:
out = "Please check naming of nodes 'Branch 1' and 'Branch 2'"
#return confirmation
OUT = out