Thursday, April 30, 2009

scipting assignment1

Frying two Eggs

For humans:
Open the eggs
Put some oil inside the pan
Put eggs in when the oil is hot
Put in some salt
Wait for five minutes

For computer:
function taking out eggs:
take two eggs out of the box
if the oven switch = off
switch it to “on”

function switching on the oven:
if the oven switch=off
switch the oven to “on”

function putting in oil:
put the pan on top of the oven
open the oil bottle
put 20ml oil inside the pan
if the time=2 minutes

function putting the eggs in:
get the eggs
open the shell of one egg
place it inside the pan
open the shell of another egg
place it inside the pan
start counting time

function adding some salt:
if the desired salt>0
get the salt bag
open the salt bag
place 2mg on the top of one egg
place 2mg on the top of another egg
if time=5 minutes
else:finish

Sunday, April 26, 2009

assignment I

have a bath
##########################
human instruction
open geyser to boilwater
take a bath
dry body
####################
computer instruction
function boilwater
with geyser
set up the temperature
turn geyser.switch to "on"
when geyser.temple = 50
execute function have a shower
function take a bath
place body in bath
open geyser tap
if all body be covered by water = yes
turn off geyser tap
start counting time
if time = 15min
execute function dry body
function dry body
desiredbodyhumidity = 5%
desiredglobonskin = 0
get body out of bath
use bath towel wipe body
if desiredbodyhumidity > 5%
execute function dry body
if desiredglobonskin > 0
execute funcion dry body
else:
finish

01A_BEDZRA_Pseudo-Code: washing a plate

for humans

make soapy water
put plate in
scrub
rinse plate with fresh water

for a computer

function make soapyWater:
with kitchenSink
cover wasteWater drain
turn coldWater tap to ,,on"
if kitchenSink = 25%full:
turn coldWater tap to ,,off"
lift liquid soap
with liquidSoap:
position over kitchenSink
turn -180°
add 4 drops to coldWater
turn 180°
place on counterTop
stair coldWater
execute function putPlate

function putPlate:
lift plate
position plate over kitchenSink
lay gently in kitchenSink
execute function scrubPlate

function scrubPlate:
get sponge
with Sponge:
dip in soapyWater
stroke over plateSurfaces
place on counterTop
execute function rinsePlate

function rinsePlate:
open wasteWater drain
when wasteWater = 0:
cover wasteWater drain
turn coldWater tap to ,,on"
if kitchenSink = 50%full:
turn coldWater tap ,,off"
move plate in coldWater
If plateSurfaces = clean:
place on counterTop
finish

Saturday, April 25, 2009

boiling noodles

FOR PEOPLE:
boil the water
put noodles into the water
put them in a plate
add sauce if you want
FOR COMPUTER:
function boilWater:
with waterBoiler,
fill with cold water,
if waterBoiler=full:
stop fill
turn water Boiler switch to"on"
when water boiling
execute function put Noodles
function put Noodles:
desiredTime=10min
get noodles
with noodles:
place inside waterBoiler
start counting time
when Time=10min
turn waterBoiler switch to off
execute function fill plate
function fill Plate
get plate
place plate right to waterBoiler
with water Boiler:
move 20cm up
turn-90
if plate="full"
with waterBoiler:
turn90
move 20cm down
execute function add Sauce
finction add Sauce
desired Sauce=1
get sauce
with sauce
place inside plate
if desired Sauce>0
execute function add sauce
else:
finish

Pseduo-Code

Pseudo-Code for how to follow our Generative Scripting I


For humans:

Take a laptop to get Internet
Register account in Google Website
Follow the Generative Scripting I


For computer:

Function get Internet:
With a computer
Press on-off of computer
Desired time= 2 min
If desired time < 2:
Enter Windows system
Else:
Reopen
Cable plug in
Open the Internet window
Input "www.Google.com" into Address field
Press "Enter"
Desired time = 5 sec
If desired time < 5 sec:
Connect the Internet
Else:
Reconnect
Execute function register account
Function register account
Click "sign in"
Input Email address
Press "Tab"
Input password
Click “sign in”
Desired time = 5 sec
If desired time < 5 sec:
Register done
Else:
Rewrite User name (Email) and Password
Execute function register account
Function follow the Scripting I Group
Input the "http://gs-i blogspot.com" into address filed
Press "Enter"
Click "view blog"
Click "Follow"
Input email and password
Click sign in
Desired time = 5 sec
If desired time < 5 sec:
Execute function follow Scripting I Group
Else:
Finish.

Friday, April 24, 2009

clau.pseudo-code

Although I tried many times that the format looked nicer (using/not using tab) with the Format for blogging, I couldn´t achieve it. I don´t know what is the mistake. But here is the exercise.

Buy a train ticket to Berlin in a ticket-vending machine.
For humans
Go to the ticket machine
Press the button Ticket- Reservation
Select the departure and destination cities
Select the date and time
Select the number of travelers
Select the means of transport
Press search button
Select the journey that fit best with your request
Press purchase button and proceed to buy the ticket


For computer
function informationRequest:
with ticketMachine
press ticketMachine.monitor
select ticketReservation.button
press departure.button
with the keyboard on the monitor
write Dessau
press DessauHbf.button
press destination.Key
with the keyboard on the monitor
write Berlin
press BerlinHbf.button
desiredDay = Today
desiredTime = 23:00
desiredTravelers = Adult
desiredTravelers.number = 1
desiredTravel.class= secondClass
desiredMeansTransport = localTransport
press search.button
execute function informationRequest

function selectionJourney:
on standardFare.column and
along dep 23.17 arr 01:06.row
press purchase.button
execute selectionJourney

function buyTicket:
get credit.Card
with credit.Card
move 20 cm right
move 5 cm up
insert credit.Card inside ticketMachine.slot

when hear “beep” sound
remove creditCard
put creditCard in initial position
with keyboard near ticketMachine.slot
write creditCard.pinCode
press B button
wait monitor change image
move 60 cm down
open window
remove ticket
execute buyTicket
else:
finish

Code for Making a B.L.T. Sandwich

Calendar

I created a Google Calendar for the course. As you can see, for the next two Mondays we won't have any classes. But that will mean that when everybody is back we will have extra Scripting classes, at least in the first 1 or 2 weeks.

You can check the calendar on this blog's sidebar, or go to the calendar address to see it in its entirety.

Tuesday, April 21, 2009

Assignment 01A - Pseudo-Code

In the first part of the first assignment, you should write a small, but detailed, pseudo-code, just as the tea example I gave you last class.

First write the human instructions, then "translate it" to a format a computer could possibly understand. You should pick something simple and ordinary, such as "boiling an egg", or "walking around the block".

Here is, again, the "making tea" example. For humans, we would simply write:
boil the water
put it in a cup
put a teabag in the water
add sugar if you want

But for a computer, these simple four statements would need much more thorough instructions:
function boilWater:
with waterBoiler
fill with coldWater
if waterBoiler = full:
stop fill
turn waterBoiler.switch to „on“
when waterBoiler.switch = „off“:
execute function fillCup

function fillCup:
get cup
place cup right to waterBoiler
with waterBoiler:
move 20cm up
turn -90°
if cup = „full“
with waterBoiler:
turn 90°
move 20cm down
execute function makeTea

function makeTea:
desiredSugar = 2
desiredTime = 3min

get teaBag
with teaBag:
place inside cup

start counting time
if time = 3min:
put teaBag in initial position

if desiredSugar > 0:
execute function putSugar
else:
finish

And it would go on and on. We would also need to specify what those objects are (waterBoiler, teaBag...).

When you are writing your pseudo-code, keep in mind the following overall rules:
  • Be aware if indenting: Python relies heavily on indenting to structure and process the code. It also helps make the code more organized, by nesting actions.
  • Think about all data you need to pass the computer and, most important, how and when it should use this data
You should post here your pseudo codes in the blog, along this week until Saturday, 25.04, so we can have it for next class.

In order to post your pseudo-code formatted as above, you can follow this tip.

Week 1 - 20.04

Yesterday we had our first class of the semester. Or at least we tried to: it was a pity I couldn't contact you before hand and tell you to have Maya installed in your computers for the first class, like we did last semester.

But I hope you were able to understand a bit what is Scripting about and how you can use it in Maya.

For the next class, as requested, you should all have Maya 8.5 or greater (it goes up to Maya 2009, already) installed in your laptops. Also, read the posts below for info about the required setting up process so you can smoothly start scripting.

Also, you should read the small introduction about variables I wrote for the class last semester, which repeats what I said yesterday about the subject.

Monday, April 20, 2009

Script editors

Another list, this time with Script Editors. It is highly recommended that you use a script editor to write your scripts.

Resources

Here is a list with several resources to aid you in the scripting learning process. Make good use of it!

Setting up

As a first step, all students should perform the instructions contained in the setting up document from the former Dia Scripting wiki.

Click here to go to the document directly.

Generative Scripting I - SS09

Today we start our Generative Scripting I course for the Summer Semester 09.

From the syllabus:

This is an introductory course to scripting in Maya using Python/
MEL. It will provide the student with the basic understanding
of how to use scripting to create and manipulate objects and
systems in order to be applied in their own design processes.

The course will be divided in four parts, as follows:
PART I: Point
PART II: Curve
PART III: Surface
PART IV: Volume
We will start from the most basic element in any 3D platform,
the point, passing through the curve, the surface and finishing
with the manipulation of volumes. This increasing complexity will
allow a good understanding of how to create and manipulate
these objects in different ways and, most important, how the
combination of simple elements can create complex results.

The students will be required to deliver a small assignment by
the end of each part, as well as a combination of all four parts as
a final assignment. The work will be done in groups of two, and
the delivery periods will be set as the course goes by.

The classes will take place every Monday 16:30, at the Marmorsaal in Building 01.