Dynamo Python Primer
  • Take Dynamo Further 🚀
  • 1 Hello Python 🐍
    • 1.1 Why Should I Learn to Code?
    • 1.2 Python Introduction
    • 1.3 What is IronPython?
  • 2 Seeing The Bigger Picture 🔭
    • 2.1 Context Matters
    • 2.2 What is an API?
    • 2.3 The .NET Framework
    • 2.4 Object-Oriented Programming
  • 3 Getting Started 🛴
    • 3.1 Dynamo's Python Node
    • 3.2 Boilerplate Setup Code
    • 3.3 Basics: Input and Output
    • 3.4 Common Errors
  • 4 Revit-Specific Topics 🏡
    • 4.1 Introduction to Revit's API
    • 4.2 How to Read Revit's API Documentation
    • 4.3 Doc, UIDoc, App, UIApp
    • 4.4 Unwrapping Revit Elements
    • 4.5 The FilteredElementCollector
    • 4.6 Geometry Conversion Methods
    • 4.7 Working With Parameters
      • Family Parameters
      • Global Parameters
      • Project Information Parameters
      • Group Parameters
      • Built-In Parameters
    • 4.8 Working With Transactions
    • 4.9 Opening & Closing External Files
    • 4.10 Prompting UI Selection
    • 4.11 Working With Units
    • 4.12 Built-In Categories
    • 4.13 Family Acrobatics
    • 4.14 Feedback: TaskDialogs
  • 5 Glossary 📚
  • About This Primer 👋
Powered by GitBook
On this page

Was this helpful?

  1. 2 Seeing The Bigger Picture 🔭

2.4 Object-Oriented Programming

OOP is a widely-adopted programming paradigm

Introduction to OOP

Since we are dealing with software, we have to understand a little bit about how software gets written. There are multiple approaches out there (such as procedural programming, functional programming) that this guide won't go into.

Object-oriented programming (referred to as OOP) is a very popular programming paradigm that has been widely-used in software development for decades. It consists of the user defining abstract 'Classes' in their code, which have various properties and abilities. These classes are meant to represent specific things in real life, perhaps a car or a person's bank account.

Once the necessary classes for the task have been defined, the programmer then creates usable instances of them, known as 'Objects'.

This is very much how Family creation works in Revit; users first define an abstract family (.rfa file) and then go about placing instances of it in their model.

In a nutshell, OOP is an approach to building software that revolves around defining classes and the rules for the kinds of interactions their objects might have. In order to use Python in Dynamo, you'll just need to understand this key takeaway:

  • Classes are abstract definitions, like .rfa files. They live in a bubble.

  • Objects are instances of these classes. Like placed Family Instances, they can interact with other objects.

Footnote: Classes are Data Types

Confident Dynamo users will already be familiar with manipulating the main basic datatypes: strings, integers, floats and Booleans. While these datatypes will appear in all kinds of software, each application will have its own custom datatypes as well - these are its classes.

If you use a Dynamo node to fetch a Revit document's active view, it won't be of a Boolean or an int type; it will be of a View type (actually, its long name is Autodesk.Revit.DB.View and you can test this using the Object.Type node).

Previous2.3 The .NET FrameworkNext3 Getting Started 🛴

Last updated 5 years ago

Was this helpful?