Scripting and Computational Geometry by Dritsas

Page 1

25/01/2010

Scripting and Computational Geometry

Scripting and Computational Geometry Compiled by Stylianos Dritsas in Spring of 2003, reedited Summer 2004 Copyright (C) 2003-2004 Stylianos Dritsas. All rights reserved.

Introduction In this document I collected some basic information about scripting, hoping that to help some people interested in finding an easy way to access computation for design purposes. The thing is that I cannot explain ev erything because either it will take too long (and it would be painful for both of us) but also because there are many things that I am not aware of. Anyway this paper runs fast and in breadth (rather than depth), it cov ers pretty much most of the commonalities (yet banalities) of coding, so after this maybe you will be a better coder (I cannot promise for anything else; it's up to you though). I will use the Rhino as a CAD platform because it contains all essential back end/front end of computational geometry and also it is an easy and relativ ely open env ironment for experimentation. Rhino uses v bscript as an embedded scripting language. Ev en though v bscript is not one of the most powerful computer languages, it has wide range of applicability, it is fairly easy to learn and pretty flexible. Anyway, once you know one language it is easier to jump into any other.

Structure It turns out that most of the computer languages are founded in only four basic conceptual components. Ev en though the syntax changes from one language to the other, these concepts remain the same. So, once you learn one language adequately, it will be easier to access any other. 1. Data definition and manipulation (describe information) 2. Conditional execution (control the flow of a program) 3. Iterativ e execution (compress processing by repetition) 4. Modularize (organize code for reuse)

Information - Data Types - Variables Information in computers is always based on numeric quantities. The fact that we can type text, draw images or model three dimensional objects is possible once we hav e a stable set of conv entions that allow us to interpret numbers as something else; something that belongs to a higher lev el in perceptual quality but nev ertheless quantitativ e and numeric in essence. Keep that in mind, because this is the essence of modeling in computation: figure out how to describe things by numbers. Information in computers is manipulated through v ariables. A v ariable is something like a container of a v alue (in the memory of the computer) that we can access and modify by using a text-name in a piece of code. So, a v ariable just allows you to store and access a v alue. In v bscript you use the keyword "dim" to declare a v ariable. Ev en though you are not forced to do it in v bscript, I think it is a v ery good idea to do so.

dim identifier

W here, identifier is the v ariable's name. Sometimes people use the term identifier instead of v ariable. There are two kinds of rules for naming new v ariables: 1. Explicit Rules Enforced by the Language: This means that if these rules/conv entions are broken (by you), then there will be error(s) reported (for sure). You will get pissed off, might want to break stuff, etc. So, the name of a v ariable: a. must not contain space characters " " [ERROR]

‌jeneratiff.com/‌/scripting_book.html

1/27


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Scripting and Computational Geometry by Dritsas by Pablo C. Herrera - Issuu