Upgrading Python

Hi everyone,

It has been a very long time since I have posted and indeed since I have used Dynamo.
I am currently working in Dynamo Revit 2.16.1.6510 and Revit 2023.1.

I have created a super basic script using the latest versions of Orchid, Data-Shapes and clockwork.

I know the upgrade went from 2 to 3, but how do I modify these Python nodes to get them to work with the script? I thought that the updated packages would contain python 3 but it appears they dont.
Here is the script I put together just to test

When I save the file and reopen, this is the message I get:
image

When I install the requested IronPython2 dependency, nothing happens. I’m just a little unsure of the process now days if someone could point me in the right direction I would appreciate that.

thanks a lot!

@Sigma ,

you can download it from the package manager both

Ironpython2

Ironpython3

KR

Andreas

1 Like

Hi @Draxl_Andreas

Thanks, I do currently have them both installed, but when I run nothing happens, just blanks across the board. Anything else that it could be?

@Sigma ,

seems to be in the clockwork node…

…data-shapes works well i got GUIs


thats the code…

import System
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

inputdoc = UnwrapElement(IN[1])
if inputdoc == None:
	doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.RevitLinkInstance":
	doc = inputdoc.GetLinkDocument()
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.Document":
	doc = inputdoc
else: doc = None
version = IN[2]

names = []
cats = []
vag = []
pgs = []
pts = []
uts = []
isvis = []
elems = []
guids = []
isinst = []
bics = []
iterator = doc.ParameterBindings.ForwardIterator()
while iterator.MoveNext():
	vag.append(iterator.Key.VariesAcrossGroups)
	names.append(iterator.Key.Name)
	pgs.append(iterator.Key.ParameterGroup)
	if version > 2021: 
		pts.append(iterator.Key.GetDataType())
		uts.append(iterator.Key.GetDataType())
	else: 
		pts.append(iterator.Key.ParameterType)
		uts.append(iterator.Key.UnitType)
	isvis.append(iterator.Key.Visible)
	elem = doc.GetElement(iterator.Key.Id)
	elems.append(elem)
	if elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':
		guids.append(elem.GuidValue)
	else: guids.append(None)
	if iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':
		isinst.append(True)
	else:
		isinst.append(False)
	thesecats = []
	builtincats = []
	for cat in iterator.Current.Categories:
		try:
			thesecats.append(Revit.Elements.Category.ById(cat.Id.IntegerValue))
		except:
			# Return null if category is not supported by Dynamo
			# This way the user knows there are unsupported categories assigned
			thesecats.append(None)
		builtincats.append(System.Enum.ToObject(BuiltInCategory, cat.Id.IntegerValue))
	cats.append(thesecats)
	bics.append(builtincats)
OUT = (names,cats,vag, pgs, pts, uts, isvis, elems, guids, isinst, bics)

KR

Andreas

1 Like

Thanks so much, you’re right, it’s something to do with the clockwork node.
I replaced it with an Orchid one for now to at least get the data, thanks for that.

1 Like

Hi, Andreas. Is it enough though to install the python packages? I got this weird issue with Genius Loci package which used to worked perfectly, now some nodes do, others don’t. Related to Legend Component, I used it the Create Legend Component effortlessly in previous versions, now it stopped working. I switched manually the python version and ran the utility, but still nothing. The only Legend Component related node from GL that I could still use as a workaround method (use a template of legend and just switch the types) is Select by View. However, this node is still using Python 2, I haven’t updated it yet. So what other methods to update to the newest Python for all packages are there? For example Genius Loci is the latest version so I didn’t even think it needs updating. What am I doing wrong? Hope this is not too all over the place and explanation. Thanks in advance!

Hi,
I confirm that it is enough to install the DynamoIronPython2.7 package for the Genius Loci package nodes to work normally. You don’t have to take any editing action.

Good old package reinstall did the trick, apollogies for reopening the subject.