Add mdbook
This commit is contained in:
parent
3850ec011c
commit
146e83f8ae
56 changed files with 817 additions and 9 deletions
38
book/src/api/basics/modules.md
Normal file
38
book/src/api/basics/modules.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Modules
|
||||
|
||||
The first step when writing is script is importing the `geometry_script` module. There a are a few ways of doing this:
|
||||
|
||||
## Import All Names (Recommended)
|
||||
This will import every type and function available into your script. It can make it easy to discover what's available with code completion, and makes the scripts more terse.
|
||||
```python
|
||||
from geometry_script import *
|
||||
|
||||
cube(...) # Available globally
|
||||
my_geo: Geometry # All types available as well
|
||||
```
|
||||
|
||||
## Import Specific Names
|
||||
This will import only the specified names from the module:
|
||||
```python
|
||||
from geometry_script import cube, Geometry
|
||||
|
||||
cube(...) # Available from import
|
||||
my_geo: Geometry
|
||||
```
|
||||
|
||||
## Namespaced Import
|
||||
This will import every type and function, and place them behind the namespace. You can use the module name, or provide your own.
|
||||
```python
|
||||
import geometry_script
|
||||
|
||||
geometry_script.cube(...) # Prefix with the namespace
|
||||
my_geo: geometry_script.Geometry
|
||||
```
|
||||
```python
|
||||
import geometry_script as gs
|
||||
|
||||
gs.cube(...) # Prefix with the custom name
|
||||
my_geo: gs.Geometry
|
||||
```
|
||||
|
||||
Now that you have Geometry Script imported in some way, let's create a tree.
|
||||
Reference in a new issue