Introduction

In this section, we will learn about modules and libraries in Python. Modules are a way to organize the code logically, and make it easier to manage and reuse. Libraries are collections of modules, and provide a coherent toolbox to tackle specific problems.

Actually, you have already used a library in this course: the Python Standard library! You have used functions such as print()or len(), and yet you have never defined them. That’s because they are part of the Python Standard library, which is a collection of modules that are already available in your Python installation. So those functions were already defined for you!

We will show you how you can make and import your own modules, and then we will introduce you to the RhinoCommon library and the way Rhino manages the elements in the document. That way we will be able to modify or delete existing elements in Rhino, and create new ones from scratch.

Note:

rhinoscriptsyntax is another library that actually relies on the RhinoCommon library. For that reason we choose to limit ourselves to RhinoCommon, but don’t hesitate to check how the rhinoscriptsyntax library is made