From the course: Dynamo for Revit: Python Scripting
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Saving our own module
From the course: Dynamo for Revit: Python Scripting
Saving our own module
- [Voiceover] Just as we can import and utilize modules from python files, we can also save our own python modules and import them into different scripts. So in this video let's have a look at how we can do that. I currently have the Dynamo exercise file open for this video. In here you'll find a python script. And as you can see, I've already defined a function name, ThreeMultis, which takes a list of numbers as the input and returns a list of numbers from that list which are divisible by three. It does this by using the built-in function, isInstance. This checks if the first parameter is the same object type as the second parameter, and if so returns true. This makes the function safe, so it's not trying to operate on a non-list item. If it is a list, a loop will iterate through each of the list of numbers, and appends any number that is modulus three and not zero. And then after the loop ends, it will return this list of numbers. So say we wanted to save this function to reuse…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Built-in Python modules6m 58s
-
(Locked)
Extending Python modules4m 30s
-
(Locked)
Saving our own module5m 6s
-
(Locked)
What is IronPython?2m
-
Accessing Revit nodes6m 18s
-
(Locked)
Importing the Revit API3m 12s
-
(Locked)
Working with the Revit API7m 46s
-
(Locked)
Revit conversions5m 53s
-
(Locked)
Dynamo conversions6m 57s
-
(Locked)
Navigating the Revit API5m 49s
-
(Locked)
-
-