Hello everyone,
This might be a really stupid question, but I have zero experience with python.
I am trying to convert a some lists of points into XYZ. I got this python script from the forum and it works perfect for a single point list. I want it to work for several lists of point. Can somebody help me? And also recommend me some videos/tutorials in order to start learning python?
Thanks,
Daniel
# Load the Python Standard and DesignScript Libraries
import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
OUT = [x.ToXyz() for x in IN[0]]
Super close. Your code is correct for a single list, but not multiple. You need another loop for each sublist in your input list as well as output lists to append to. Something like:
output = []
for sub in IN[0]:
output.append([x.ToXyz() for x in sub])
OUT = output
Thanks a lot! Any idea where can I learn some more python for dynamo?
Revitapidocs is great for learning the Revit API. Python has tons of free tutorials, videos, and forums available online. And of course the Dynamo forums here are a good source for both, though not always as in-depth.
Here’s a collection of basics we’ve collected on the forums: Python Nodes Basics
2 Likes