Join Jeremy Graham for an in-depth discussion in this video Try and except, part of Dynamo for Revit: Python Scripting.
- [Instructor] When creating geometry…or anything that requires validator…to execute correctly, there's always room…for errors that might cause the path…and script to fail.…To handle this, we need to understand…two more keywords, try and except.…In the exercise file, you can see…on the workspace that I've created…a series of points.…However, to demonstrate the use of the try…and except keywords, I have substituted…a point at index seven with a true Boolean.…Working in Dynamo, we often work with lists…of data in which objects my vary in type.…
So what if we want to loop through…each of these points…and extra the X coordinate in Python?…Let's go ahead and try this…by creating a new Python script,…and inputting the list of points into port zero.…The first thing we need to do…is retrieve the input.…So let's assign input zero to points…and create a list name output,…which we can use to append to.…So let's see what happens…when we simply loop through the points list…and try to retrieve the Z coordinate…of the point and append it to our list.…
Note: This course uses Dynamo 1.3.1 and Revit 2018. For best results, it helps to have the same versions of the software.
- Importing the Dynamo Geometry library
- Defining variables
- Making decisions with conditionals
- Controlling flow with operators
- Defining functions
- Working with external libraries in Python
- Accessing the Revit API with Python
Skill Level Intermediate
1. Dynamo and Python
2. Python Basics
3. Working with Libraries
4. Revit API
Next steps2m 18s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.