Week 1

Arch 2042 2012 Spring

Course Arch 2042
Date 2012/02/24
Learning Objectives We will give an overview of the class, frame the topic of practical computation by introducing the concepts of algorithm and data structures through the use of a simple toolkit, and set up the infrastructure to begin coding in Rhino-Python.
Agenda
  • Welcome and Course Introduction
  • Lecture 1
    • A Brief History of Computers in Architectural Design
    • Practical Computation
  • Workshop 1
    • Setting up Rhino-Python
    • Object Representation and Manipulation
    • Control Flow
Uses Tool(s)

Lecture 1

Workshop 1

Setup

  • Rhino-Python Setup: Please have the latest Rhino 5 for Windows WIP or the latest Rhino for OSX WIP installed.
  • Script Editor Setup: The Windows setup includes a built-in script editor that can be launched with the “_EditPythonScript” command in Rhino. The OSX version currently does not include this editor; instead, you will be installing Komodo Edit (free). Please follow these instructions
  • Running Scripts: If using the built-in editor in Windows, you can simply type in your script and press the Run button. For OSX, You will be able to run scripts by typing in the command -RunPythonScript and navigating to the Scripts/ folder which can be found at /Users/<your user name>/Library/Application Support/McNeel/Rhinoceros/.

Object Representation and Manipulation

Representation of the common objects and operations that are the building blocks to code, illustrated diagrammatically where possible.

Object Types
data stored in a computer is often represented as one of several basic "types".
Variables
variables allow us to store data in a "container" for later access and manipulation.
Operations & Expressions
data can interact and be manipulated in a number of ways.

Control Flow

How do computers execute instructions? The control-flow statements specify the order in which computations are performed.

Conditionals
statements that are used to express decisions.

Assignment

Compass-Straightedge Constructions :

  • Illustrate the construction for ab.
  • Given a line l and a point p (not necessarily on the line l), develop an algorithm to construct a perpendicular line to l though p. Do this by precise illustration and description. Make sure that your algorithm takes into account the case when p also falls on l.

Programming Exercise :

The goal of this simple programming exercise is to get you comfortable with the workflow of developing in a script editor, using simple elements in Python, running a script and seeing the output. This exercise includes standard elements of a program such as the ability to print out results, the ability to read input (detailed below), and the ability to store values in a variable, so that the program can access that value as needed.

Write a program that does the following:

  1. Asks the user for his/her first name. You will need to use the rhinoscript package and use the command rs.GetString:
import rhinoscriptsyntax as rs
firstName = rs.GetString('Enter your first name')
  1. Asks the user for his/her last name.
  2. Ask the user for a positive integer n. You can do this by using the command rs.GetInteger.
  3. Prints out the first name and last name (with a space in between) n times in a row.

Your output in the command history should look something like:

Enter your first name: Joy
Enter your last name: Ko
Enter a positive integer: 5
Joy Ko Joy Ko Joy Ko Joy Ko Joy Ko