We are a collaborative team from the IBois lab, specializing in computational design and digital fabrication with wood.
Your turn:
Please tell us:
Your name
Why you are taking this course (what do you expect to learn)
Your experience with programming (if any)
Course objectives:
Give you some starting tools to apply computational tools to your own projects
Develop a computational mindset
Introduction to coding and the benefits of computer science in design practice
## Course charge:
|||
|:--:|:--:|
|**Week 1**|introduction to scripting|
|||
|**Week 2**|Python I|
|**Week 3**|Python II|
|**Week 4**|Object-oriented programming I|
|**Week 5**|Object-oriented programming II|
|||
|**Week 6**|Libraries, Modules and RhinoCommon|
|**Week 7**|2D Geometry|
|**Week 8**|Transformations|
|**Week 9**|3D Geometry|
|**Week 10**|Breps|
|**Week 11**|Boolean operations|
|**Week 12**|Next steps|
---
## Course charge:
- **3** ECTS
- **90** hours of work, of which on average:
- **2** hours of lectures per week
- **5** hours of homework per week
---
# Course format:
Lectures + online material accessible BEFORE class EXCEPT solutions for in-class exercises
Interactive class (inclusive atmosphere expected from teacher and students)
---
## Expected from you:
- Participation during the course
- Pro-active attitude for class exercises (you will need them for the assignments)
- Be active in the Slack channel to answer/post of your collegues
---
## Grading:
You will have 9 assignments to complete in a week.
||||
|:--:|:--:|:--:|
|**A1**|5%|*macros*|
|**A2**|10%|*Python basics I*|
|**A3**|10%|*Python basics II*|
|**A4**|15%|*Object-oriented programming*|
|**A5**|15%|*RhinoCommon*|
|**A6**|15%|*2D geometry*|
|**A7**|15%|*Transformations*|
|**A8**|15%|*3D Geometry*|
|**A9**|15%|*Final*|
Assignments submitted on Moodle
---
## Grading:
- Each assignment will be separated in two parts:
- "*fill-the-gaps*" part: on will complete a code with missing lines (40% of the assignment grade)
- *Creative part*: you will have to create a new code of your own (60% of the assignment grade)
- 3 points if the code runs without errors
- 2 points if the code is efficient and well written
- 1 point if the code is tidy and clean
---
## Communication:
- All day-to-day communication will be done through Slack.
- Common channel where you can ask questions and help your collegues.
- You can also send private messages to the teaching team.
- Administratively important information will be sent by email.
- All course material will be available on the course website:
---
## Course material:
All course material will be available on the course website:
- Web pages for theory (they contain a bit more than the official course content)
- Course slides (these ones)
Why Rhino ?
There is a lot of CAD software out there...
Rhino has good (visual) scripting capabilities
We will concentrate on Rhino + Python
Rhino Interface
Rhino interface overview
Rhino interface overview
🔨 Rapid exercice (1 min)
Open Rhino
Draw a line using the toolbar
Draw a line using the terminal
🔨 Rapid exercice (3 min)
Now that we know the 2 methods to add geometry objects to the Rhino workspace, try to add a line with the following characteristics:
start point = {0, 0, 0}
end point = {3, -4.6, 5}
What is the fastest of the previous methods to achieve this result?
Change gumball position : option tab at the bottom of UI
Auto-reset gumball : option tab at the bottom of UI
🔨 Rhino exercice (27 min)
Try to use what we just learned about geometry manipulations in Rhino. Open the file 20210907_rh_transformation_start and recreate the geometry of the IBOIS Mendrisio timber pavillon
Macros
What are macros?
Macros are the first stepping stone towards coding in Rhino (and going down the rabbit hole). They are made to automate simple, repetitive tasks within Rhino. And it’s the simplest level of scripting that you can find. They simply combine Rhino Commands together in one call.
Learn more about macros
What are macros?
They simply combine Rhino Commands together in one call.
Where to script macros ?
The macro editor can be found in the property panel. If you don’t have it have a look at the settings icon (little grey gear) on the top right of the property panel.
Let's see an example of a basic macro:
Can you explain which element does what in the script ?
! _Box _Center _Pause r5,5 _Enter
Let's see an example of a basic macro:
Can you explain which element does what in the script ?
! _Box _Center _Pause r5,5 _Enter
/* Explanation of the commands:
! : it erases all previous command
_Box : it calls the Box command ("_" for the English command)
_Center : Specifies the drawing method for the box (from its center)
_Pause : We need to wait for user input
r5,5 : r means relative, 5,5 is the distance from the user-defined center
_Enter : Command to simulate the Enter key
*/
Useful commands in macros:
Can you understand what each of the following commands does?
Can you understand what each of the following commands does?
_Select # Select a number of objects
_SelLast # Select the last object added to the space
_SelPrev # Select the last object
_SelNone # Deselect
_SetObjectName # Set object name
_SetGroupName # Set group name
_SelGroup # Select grouped objects
_SelName # Select an object by name
_Group # Group objects
_Ungroup # Ungroup objects
Useful symbols in macros:
* # Causes the command to repeat automatically without pressing Enter to restart
! # Cancels the previous command
_ # Runs command as English command name
- # Suppress any dialog box
' # The apostrophe tells that next command is a nestable command. (geometry creations are never nestable)
/ # If the first character in a toolbar macro is not "!" and the last charcter is "/", the script runs on the command line without "Enter", so more information can be added.
~ # Suppresses command options for clutter free command feedback
; # To comment a macro
🔨 Macro exercice (15 min)
Make a macro that in 1 click does:
* add one blue, red, and green box with dimensions {1, 1, 1}
* align the boxes along the (1, 1, 1) axis, each separated by 0.5 unit
5% Assignment: Automatize hole punching with macros
- 100% of the grade: You are tasked with making many holes in a plate with different angles (indicated by starting and ending point).
Macros can help you save some time. Write a macro that can automatize part of the operations of making holes in the plate. Extra bonus will be assigned to the shortest (as possible) macros.