In Dynamo, nodes are essentially methods and functions that are connected with wires. In Python, you define your own functions. Create a function that would be unachievable in Dynamo otherwise.
- [Narrator] In an earlier class,…we learned how to create a list of numbers…using the Range function.…This built-in function takes a number as a parameter…and generates a list of sequential numbers…based on the input.…We can also create our own functions…if we find we are reusing the same piece of script…over and over.…So in a new Dynamo file,…let's go ahead and create a new Python script…in which we'll create our first function.…To understand functions,…let's start with something simple:…A function that simply returns a number.…
To create the function, we start with a keyword def,…or D-E-F,…which is short for define,…followed by a unique name…so that it doesn't conflict with any other names in Python.…Let's call ours Myfunction.…After the function name, we then put a parentheses.…Between these is where…we can put parameters for the function.…Let's keep this one simple.…So we'll just use an open and closed parentheses…then end the line with a colon as if it were a statement.…Any code that we want to be part of the function…
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 Beginner
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.