A High-Level Pedagogical 3D Modeling Language and Framework
Total Page:16
File Type:pdf, Size:1020Kb
A High-Level Pedagogical 3D Modeling Language and Framework Filipe André Cabecinhas May 14, 2010 1 Introduction architects must be taught how to program. In the past, traditional architecture avoided com- There has been an increasing effort on provid- plex geometric objects due to the lack of tools and ing architects with programming background, by excessive cost of materials and parts which had to teaching them how to program and how to use be made specifically to build these objects. Nowa- these modeling tools. However, the programming days, with computer aided design (CAD) and com- focus has been mostly on automating simple te- puter aided manufacturing (CAM) tools, it is pos- dious tasks, such as long sequences of commands. sible to mass-produce unique parts for roughly the same cost of producing the same quantity of iden- tical parts [7], thus allowing a higher degree of free- This thesis presents the VisualScheme program- dom to the architect. ming language, which intends to be a 3D model- We believe architects should be able to express ing language oriented to architects. This program- themselves and realize their vision, whatever that ming language is a domain specific language (DSL) may be. And, to model shapes based on mathemat- for 3D modeling built on top of the Scheme pro- ical functions, architects must use programming gramming language. VisualScheme provides mech- tools to aid them in building the desired model. It anisms for a programmer to define a 3D model of is known that most vanguardist buildings such as an object and then export it to a visualization pro- the “Pála Siza Vieira”, from Portugal’s Expo 098 gram (the worker program). This 3D model is not pavilion or the Guggenheim museums’ buildings in composed of the definition of all the object’s ver- Bilbao and New York are usually based on well- texes or triangles, but as a tree of high-level prim- defined mathematical functions that can be com- itives and operations which will then be passed to puted, meaning that those buildings can be gener- a back-end which will convert the tree of primitives ated programmatically. and operations to the commands to be sent to the Experimentation is another important require- worker program. ment that justifies the programmatic generation of forms: when idealizing the form of a complex geo- This paper comprises 6 sections: section 1 in- metric object, the designer may want to experiment troduces the work and presents its goals. The re- with different parameters for its components. How- lated work is presented in section 2 and the four ever, with a programmatic approach, an architect main stages of this project in section ??. Section 3 may design a fully-parametrized object definition presents the language proposed here, called Visu- and then just change the parameters until the gen- alScheme, describing the technical aspects related erated form satisfies the initial vision. to the implementation of the language, and how Nowadays architects need to hire a group of pro- a VisualScheme program is organized. Section 4 grammers if they want to model a complex, out of presents a case study (the Gare do Oriente model) the ordinary shape. This solution is costly and may with VisualScheme, and compares it to a solution cause a mismatch between what the architect en- in Grasshopper. Finally, section 5 concludes the visioned and the end result. To solve this problem, thesis and suggests some guidelines for future work. 1 1.1 Technical Contributions AutoLISP scripts to automate some simple repet- itive tasks. These tasks are usually very easy to With this work we designed and implemented the accomplish either by hand or by programming. VisualScheme programming language with facili- With AutoLISP, programmers can write a script ties for modeling 3D objects, as well as a back- that uses AutoCAD’s API to manipulate objects in endfor AutoCAD. The language allows an architect a document. An AutoLISP script has access to a with average programming skills and a familiarity large number of AutoCAD’s object creation func- with CAD tools the ability to produce complex ob- tions, including functions to create primitive geo- jects. This language will be able to export its ob- metric objects like circles, lines, spheres, poly-lines jects to several formats, maximizing the rewards of and text. And operations on those objects, such as learning it by allowing the programmer to export unions, intersections and subtractions. AutoCAD’s to whatever format the client desires. objects are also available in AutoLISP, represented We also took into account pedagogical aspects as entities. like the students’ needs, as this language is aimed at classroom and industry usage. The language was tested by students throughout its development 2.1.1 Conclusions stages, which helped understand where inexperi- Being the most used CAD program in the world, enced users have more difficulty. AutoCAD and its programmability features must be taken into account for this work. Despite show- ing its age, AutoLISP is still used by many groups 2 Related Work of people with disparate programming skills, for automating all kinds of tasks in AutoCAD. Al- In the following sections, several existing 3D mod- though widely used, its potential is very under- eling programming languages will be analyzed from utilised. Many architects either don’t know it’s the programmer’s point of view. available or only use it by emulating what they A program that draws a set of Greek columns would do manually. was written in every analyzed language so as to compare the languages and their pragmatics. 2.2 Generative Modeling Language 2.1 AutoLISP and Visual LISP The Generative Modeling Language (GML)4 is a simple stack-based language for describing 3D ob- Autodesk™1 is one of the leading vendors of jects. Traditionally, lists of geometric primitives architecture-related software in the world. Its Au- are used to model 3D objects. Instead, with a gen- toCAD®2 line of products is one of the oldest and erative approach [11], geometric models are created most widely used in the area of CAD. 3 by composing operations and the design becomes AutoLISP® [3] is a Lisp-based programming focused on rules for transforming primitive objects language with a small kernel and a large set of instead of focusing on combining these primitives. geometric primitives used in AutoCAD for script- GML is a PostScript based language which ex- based geometric modeling. AutoLISP was designed tends it with a set of operations, from vector alge- to be used in conjunction with CAD tools like Au- bra to the handling of polygons, including several toCAD to automate repetitive tasks or to be used conversions [6]. Being a postfix language, it’s not when precision is of the utmost importance and the very easy to learn to someone who is not famil- manual tools don’t fit the job.. iarised with programming, in general, at least. Most architects only use AutoCAD with its point-and-click interface or, for the few (compara- tively) of those that use AutoLISP, have some small 2.2.1 Conclusions 1http://autodesk.com Despite being an unusual programming language 2http://autodesk.com/autocad (due to being stack-based), GML can accomplish 3http://usa.autodesk.com/adsk/servlet/index? siteID=123112&id=1911627 4http://www.generative-modeling.org/ 2 what it’s designed to: Being a terse postfix pro- out of David Buck’s hobby ray-tracer, DKB- gramming language, which enables programmers t Trace [15]. With its large comprehensive library of describe shapes with relative ease and without hav- objects, colors, textures, and many available special ing to model every used mesh. By modeling the effects and rendering effects, POV-Ray is one of the objects using a high-level language, GML doesn’t most widely used ray-tracers around the world, and need as much information as a mesh-based program has a very large community 7 where users can find to store the objects. help. 2.3 Programming LAnguage for 2.4.1 Scene Description Language Solid Modeling POV-Ray’s Scene Description Language (SDL) is a Turing-complete language that allows a program- The Programming LAnguage for Solid Modeling mer to describe the world in an efficient and read- (PLaSM) is a functional programming language able way. The scene description language is a very based on IBM’s®5 FL [1] programming language. basic language with support for abstraction mech- It is a functional design language for geometric and anisms (e.g. macros and functions). It’s mostly a solid parametric design developed at the Roma Tre declarative language, which means most of the ob- and La Sapienza universities [13, 12]. jects are defined at one time in the program execu- PLaSM takes on a programming approach to tion and aren’t modified afterwards. generative modeling, where geometric objects are generated by composing functions using the lan- guage’s operators. It has a dimension-independent 2.4.2 Conclusions approach to geometric representation. PLaSM has POV-Ray is a very good ray-tracer with a very support for higher-order functions in the FL style helpful community built around it. It is capable of so, one way to look at it, is to see PLaSM as a generating very high-quality photo-realistic render- geometric domain-specific language (DSL) for FL. ings with small scripts due to its big high-quality No free nesting of scopes or pattern matching is al- object and texture library. The language in itself is lowed in PLaSM although an identifier can name declarative, although some support for imperative any language object. programming is present, in the form of macros.