Genworks GDL: A User's Manual - Genworks International

351
Genworks GDL: A User’s Manual Dave Cooper January 2016

Transcript of Genworks GDL: A User's Manual - Genworks International

Page 1: Genworks GDL: A User's Manual - Genworks International

Genworks GDL: A User’s Manual

Dave Cooper

January 2016

Page 2: Genworks GDL: A User's Manual - Genworks International

ii

0Copyright © 2012, Genworks International. Duplication, by any means, in whole or in part, requires writtenconsent from Genworks International.

Page 3: Genworks GDL: A User's Manual - Genworks International

Contents

1 Introduction 11.1 Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Knowledge Base Concepts According to Genworks . . . . . . . . . . . . . . . . . . . 11.3 Classic Definition of Knowledge Based Engineering (KBE) . . . . . . . . . . . . . . . 21.4 Runtime Value Caching and Dependency Tracking . . . . . . . . . . . . . . . . . . . 21.5 Demand-Driven Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.6 Object-oriented Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.7 Object-oriented Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.8 Object-oriented Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.9 The Object-Oriented Paradigm meets the Functional paradigm . . . . . . . . . . . . 41.10 Goals for this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.11 What is GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.12 Why GDL (i.e., what is GDL good for?) . . . . . . . . . . . . . . . . . . . . . . . . . 51.13 What GDL is not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Installation [GDL and Gendl] 72.1 Installation of pre-packaged GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.1.1 Download the Software and retrieve a license key . . . . . . . . . . . . . . . . 72.1.2 Unpack the Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Installation of open-source Gendl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.1 Install and Configure your Common Lisp environment . . . . . . . . . . . . . 82.2.2 Load and Configure Quicklisp . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.3 Load and Start Gendl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 System Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3.1 Basic Sanity Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3.2 Full Regression Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.4 Getting Help and Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Basic Operation of the GDL Environment 133.1 What is Different about GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2 Startup, “Hello, World!” and Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.2.1 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2.2 Developing and Testing a “Hello World” application . . . . . . . . . . . . . . 163.2.3 Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.3 Working with Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

iii

Page 4: Genworks GDL: A User's Manual - Genworks International

iv CONTENTS

3.3.1 Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.3.2 Source Files within a source/ subdirectory . . . . . . . . . . . . . . . . . . . . 18

3.3.3 Generating an ASDF System . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.3.4 Compiling and Loading a System . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4 Customizing your Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.5 Saving the World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.6 Starting up a Saved World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

4 Understanding Common Lisp 21

4.1 S-expression Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.2 Fundamental CL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4.2.1 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.2.2 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.2.3 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.2.4 List Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4.2.5 The List as a Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5 Understanding GDL — Core GDL Syntax 29

5.1 Defining a Working Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5.2 Define-Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5.3 Making Instances and Sending Messages . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.4 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.5 Sequences of Objects and Input-slots with a Default Expression . . . . . . . . . . . . 34

5.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

6 The Tasty Development Environment 35

6.0.1 The Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6.0.2 View Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

7 Working with Geometry in GDL 41

7.1 The Default Coordinate System in GDL . . . . . . . . . . . . . . . . . . . . . . . . . 41

7.2 Building a Geometric GDL Model from LLPs . . . . . . . . . . . . . . . . . . . . . . 44

7.2.1 Positioning a child object using the center input . . . . . . . . . . . . . . . . 47

7.2.2 Positioning Sequence Elements using (the-child index) . . . . . . . . . . . . . 47

7.2.3 Relative positioning using the translate operator . . . . . . . . . . . . . . . . 47

7.2.4 Display Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

7.2.5 Orientation and the Alignment function . . . . . . . . . . . . . . . . . . . . . 52

7.2.6 Rotating vectors with the rotate-vector-d function . . . . . . . . . . . . . . . 52

7.2.7 Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

7.2.8 Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

7.2.9 Other Geometric Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Page 5: Genworks GDL: A User's Manual - Genworks International

CONTENTS v

8 Custom User Interfaces in GDL 61

8.1 Package and Environment for Web Development . . . . . . . . . . . . . . . . . . . . 61

8.2 Traditional Web Pages and Applications . . . . . . . . . . . . . . . . . . . . . . . . . 61

8.2.1 A Simple Static Page Example . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.2.2 A Simple Dynamic Page which Mixes HTML and Common Lisp/GDL . . . . 64

8.2.3 Linking to Multiple Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

8.2.4 Form Controls and Fillout-Forms . . . . . . . . . . . . . . . . . . . . . . . . . 66

8.3 Partial Page Updates with gdlAjax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

8.3.1 Steps to Create a gdlAjax Application . . . . . . . . . . . . . . . . . . . . . . 71

8.3.2 Including Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

9 More Common Lisp for GDL 77

10 Advanced GDL 79

11 Reference for GDL Objects and Operators 83

11.1 cl-lite (Compile-and-Load Lite Utility) . . . . . . . . . . . . . . . . . . . . . . . . . . 83

11.1.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

11.1.2 Function and Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.2 com.genworks.dom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.3 com.genworks.dom-html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.4 com.genworks.dom-latex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.5 com.genworks.dom-writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.6 com.yoyodyne.booster-rocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.7 enterprise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.8 gendl (Base Core Kernel Engine) Nicknames: Gdl, Genworks, Base . . . . . . . . . . 84

11.8.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

11.8.2 Function and Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 91

11.8.3 Variables and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

11.9 gdl-user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

11.10gendl-doc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

11.11genworks-gdl (Genworks GDL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

11.12geom-base (Wireframe Geometry) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

11.12.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

11.12.2 Function and Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 164

11.12.3 Variables and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

11.13glm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.14gwl (Generative Web Language (GWL)) . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.14.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.14.2 Function and Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 200

11.14.3 Variables and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

11.15iq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

11.16jquery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

11.17raphael . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

11.18robot (Simplified Android Robot example ) . . . . . . . . . . . . . . . . . . . . . . . 203

Page 6: Genworks GDL: A User's Manual - Genworks International

vi CONTENTS

11.19smlib (Interface to SMLib Geometry Engine) . . . . . . . . . . . . . . . . . . . . . . 20311.20surf (NURBS Surface and Solids Geometry Primitives) . . . . . . . . . . . . . . . . . 203

11.20.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20311.20.2 Function and Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 31811.20.3 Variables and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

11.21tasty (Web-based Development Environment (tasty)) . . . . . . . . . . . . . . . . . . 31911.22tree (Tree component used by Tasty and potentially as a UI component on its own) 319

11.22.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31911.23yadd (Yet Another Definition Documenter (yadd)) . . . . . . . . . . . . . . . . . . . 320

11.23.1 Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

Bibliography 325

Page 7: Genworks GDL: A User's Manual - Genworks International

Chapter 1

Introduction

1.1 Welcome

Congratulations on your decision to work with Genworks® GDL™1. By investing time to learn thissystem you will be investing in your future productivity and, in the process, you will be joininga quiet revolution. Although you may have come to Genworks GDL because of an interest in 3Dmodeling or mechanical engineering, you will find that a whole new world, and a unique approachto computing, will now be at your fingertips as well.

1.2 Knowledge Base Concepts According to Genworks

You may have an idea about Knowledge Base Systems, or Knowledge Based Systems, from collegetextbooks or corporate marketing literature, and concluded that the concepts were too broad tobe of practical use. Or you may have heard criticisms implicit in the pretentious-sounding name,“Knowledge-based Engineering,” as in: “you mean as opposed to Ignorance-based Engineering?”

To provide a clearer picture, we hope you will concur that Genworks’ concept of a KB systemis straightforward, relatively uncomplicated, and practical. In this manual our goal is to makeyou both comfortable and motivated to explore the ideas we have built into our flagship system,Genworks GDL.

Our informal definition of a Knowledge Base System is a hybrid Object-Oriented2 and Func-tional3 programming environment, which implements the features of Caching and Dependencytracking. Caching means that once the KB system has computed something, it generally will not

1From time to time, you will also see references to “Gendl.” This refers to “The Gendl Project” which is thename of an open-source software project from which Genworks GDL draws for its core technology. “The GendlProject” code is free to use for any purpose, but it is released under the Gnu Affero General Public License, whichstipulates that applications code compiled with The Gendl Project compiler must be distributed as open-source undera compatible license (if distributed at all). Commercial Genworks GDL, properly licensed for development and/orruntime distribution, does not have this “copyleft” open-sourcing requirement.

2An Object-Oriented programming environment supports named collections of values along with pro-cedures to operate on those values, including the possibility to modify (“mutate”) the data. Seehttps://en.wikipedia.org/wiki/Object-oriented programming

3A pure Functional programming environment supports only the evaluation of Functions which workby computing results, but do not modify (i.e. “mutate”) the in-memory state of any objects. Seehttp://en.wikipedia.org/wiki/Functional programming

1

Page 8: Genworks GDL: A User's Manual - Genworks International

2 CHAPTER 1. INTRODUCTION

need to repeat that computation if the same question is asked again. Dependency tracking is theflip side of that coin — it ensures that if a cached result is stale, the result will be recomputed thenext time it is demanded, in order to give a fresh result.

1.3 Classic Definition of Knowledge Based Engineering (KBE)

Sections 1.3 through 1.8 are sourced from [1].

Knowlege based engineering (KBE) is a technology predicated on the use of dedicatedsoftware tools called KBE systems, which are able to capture and systematically re-useproduct and process engineering knowledge, with the final goal of reducing the timeand costs of product development by means of the following:

• Automation of repetitive and non-creative design tasks;

• Support of multidisciplinary design optimization in all phases of the design process

1.4 Runtime Value Caching and Dependency Tracking

Caching refers to the ability of the KBE system to memorize at runtime the results ofcomputed values (e.g. computed slots and instantiated objects), so that they can bereused when required, without the need to re-compute them again and again, unlessnecessary. The dependency tracking mechanism serves to keep track of the currentvalidity of the cached values. As soon as these values are no longer valid (stale), theyare set to unbound and recomputed if and only at the very moment they are againdemanded.

This dependency tracking mechanism is at the base of associative modeling, which is ofextreme interest for engineering design applications. For example, the shape of a wingrib can be defined according to the shape of the wing aerodynamic surface. In casethe latter is modified, the dependency tracking mechanism will notify the system thatthe given rib instance is no longer valid and will be eliminated from the product tree,together with all the information (objects and attributes) depending on it. The newrib object, including its attributes and the rest of the affected information, will not bere-instantiated/updated/re-evaluated automatically, but only when and if needed (seedemand driven instantiation in the next section)

1.5 Demand-Driven Evaluation

KBE systems use the demand-driven approach. That is, they evaluate only those chainsof expressions required to satisfy a direct request of the user (i.e. the evaluation ofcertain attributes for the instantiation of an object), or the indirect requests of anotherobject, which is trying to satisfy a user demand. For example, the system will createan instance of the rib object only when the weight of the abovementioned wing rib isrequired. The reference wing surface will be generated only when the generation of the

Page 9: Genworks GDL: A User's Manual - Genworks International

1.6. OBJECT-ORIENTED SYSTEMS 3

rib object is required, and so on, until all the information required to respond to theuser request will be made available.

It should be recognized that a typical object tree can be structured in hundreds ofbranches and include thousands of attributes. Hence, the ability to evaluate specificattributes and product model branches at demand, without the need to evaluate theentire model from its root, prevents waste of computational resources and in many casesbrings seemingly intractible problems to a rapid solution.

1.6 Object-oriented Systems

An object-oriented system is composed of objects (i.e. concrete instantiations of namedclasses), and the behavior of the system results from the collaboration of those objects.Collaboration between objects involves them sending messages to each other. Sendinga message differs from calling a function in the sense that when a target object receivesa message, it decides on its own what function to carry out to service that message.The same message may be implemented by many different functions, the one selecteddepending on the current state of the target object.

1.7 Object-oriented Analysis

Object-oriented analysis (OOA) is the process of analyzing a task (also known as aproblem domain) to develop a conceptual model that can then be used to complete thattask. A typical OOA model would describe computer software that could be used tosatisfy a set of customer-defined requirements. During the analysis phase of problem-solving, the analyst might consider a Written Requirements Statement, a formal visiondocument, or interviews with stakeholders or other interested parties. The task to beaddressed might be divided into several subtasks (or domains), each representing a dif-ferent business, technological, or other area of interest. Each subtask would be analyzedseparately. Implementation constraints (e.g. concurrency, distribution, persistence, orhow the system is to be built) are not considered during the analysis phase; rather, theyare addressed during the object-oriented design (OOD) phase.

The conceptual model that results from OOA will typically consist of a set of use cases,one or more UML class diagrams, and a number of interaction diagrams. It may alsoinclude some form of user interface.

1.8 Object-oriented Design

During the object-oriented design (OOD) phase, a developer applies implementationconstraints to the conceptual model produced in the object-oriented analysis. Suchconstraints could include not only those imposed by the chosen architecture but alsoany non-functional — technological or environmental — constraints, such as data pro-cessing capacity, response time, run-time platform, development environment, or thoseinherent in the programming language. Concepts in the analysis model are mapped

Page 10: Genworks GDL: A User's Manual - Genworks International

4 CHAPTER 1. INTRODUCTION

onto implementation classes and interfaces resulting in a model of the solution domain,i.e., a detailed description of how the system is to be built.

1.9 The Object-Oriented Paradigm meets the Functional paradigm

In order to model very complex products and efficiently manage large bodies of knowledge, KBEsystems tap the potential of the object oriented nature of their underlying language (e.g. CommonLisp). “Object” in this context refers to an instantiated data structure of a particular assigneddata type. As is well-known in the computing community, unrestricted modification of the stateof objects leads to unmaintainable systems which are difficult to debug. KBE systems managethis drawback by strictly controlling and constraining any ability to modify or “change state” ofobjects.

In essence, a KBE system generates a tree of inspectable objects which is analogous to thefunction call tree of pure functional-language systems.

1.10 Goals for this Manual

This manual is designed as a companion to a live two-hour GDL/GWL tutorial, but you mayalso be relying on it independently of the tutorial. Portions of the live tutorial are available in“screencast” video form, in the Documentation section of http://genworks.com In any case, ourfundamental goals of this Manual are:

• To get you motivated about using Genworks GDL

• Enable you to ascertain whether Genworks GDL is an appropriate tool for a given job

• Equip you with the ability to state the case for using GDL/GWL when appropriate

• Prepare you to begin authoring and maintaining GDL applications, or porting apps fromsimilar KB systems into GDL.

The manual will begin with an introduction to the Common Lisp programming language. Ifyou are new to Common Lisp: welcome! You are about to be introduced to a powerful tool backedby a rock-solid body of standard specifications, which will protect your development investment fordecades to come. In addition to the overview provided in this manual, many resources are availableto get you started in CL — for starters, we recommend Basic Lisp Techniques4, which was writtenby the author.

1.11 What is GDL?

GDL is an acronym for “General-purpose Declarative Language.”

• GDL is a superset of ANSI Common Lisp, and consists largely of automatic code-expandingextensions to Common Lisp implemented in the form of macros. When you write, for example,

4 BLT is available at http://www.franz.com/resources/educational resources/cooper.book.pdf

Page 11: Genworks GDL: A User's Manual - Genworks International

1.12. WHY GDL (I.E., WHAT IS GDL GOOD FOR?) 5

20 lines in GDL, you might be writing the equivalent of 200 lines of Common Lisp. Given thatGDL is a superset of Common Lisp, you of course retain the full power of the CL languageat your disposal whenever you are working in GDL.

• Since GDL expands into CL, everything you write in GDL will be compiled “down to themetal” to machine code with all the optimizations and safety that the tested-and-true CLcompiler provides [this is an important distinction from some other so-called KB systems onthe market, which are essentially nothing more than interpreted scripting languages whichoften impose arbitrary limits on the size and complexity of the application].

• GDL is also a declarative language in the fullest sense. When you put together a GDLapplication, you think and write mainly in terms of objects and their properties, and howthey depend on one another in a direct sense. You do not have to track in your mindexplicitly how one object or property will “call” another object or propery, in what orderthis will happen, and so forth. Those details are managed automatically by the embeddedlanguage.

• Because GDL is object-oriented, you have all the features you would normally expect froman object-oriented language, such as

– Separation between the definition of an object and an instance of an object

– High levels of data abstraction

– The ability for one object to “inherit” from others

– The ability to “use” an object without concern for its “under-the-hood” complexities

• GDL supports the “message-passing” paradigm of object orientation, with some extensions.Since full-blown ANSI CLOS (Common Lisp Object System) is always available as well, youare free to use the Generic Function paradigm. Do not be concerned at this point if youare not fully conversant with the differences between Message Passing and Generic Functionmodels of object-orientation.5.

1.12 Why GDL (i.e., what is GDL good for?)

• Organizing and integrating large amounts of information in ways which are impossible orimpractical using conventional languages, CAD systems, and/or database technology alone;

• Evaluating many design or engineering alternatives and performing various kinds of optimiza-tions within specified design spaces, and doing so very rapidly;

• Capturing, i.e., implementing, the procedures and rules used to solve repetitive tasks inengineering and other fields;

• Applying rules you have specified to achieve intermediate and final outputs, which may includevirtual models of wireframe, surface, and solid geometric objects.

5See Paul Graham’s ANSI Common Lisp, page 192, for an excellent discussion of the Two Mod-els of Object-oriented Programming. Peter Siebel’s Practical Common Lisp also covers the topic; seehttp://www.gigamonkeys.com/book/object-reorientation-generic-functions.html.

Page 12: Genworks GDL: A User's Manual - Genworks International

6 CHAPTER 1. INTRODUCTION

1.13 What GDL is not

• A CAD system (although it may operate on and/or generate geometric entities);

• A drawing program (although it may operate on and/or generate geometric entities);

• An Artificial Intelligence system (although it is an excellent environment for developing ca-pabilities which could qualify as such);

• An Expert System Shell (although one could be easily embedded within it).

Without further description, let’s turn the page and get started with hands-on GDL...

Page 13: Genworks GDL: A User's Manual - Genworks International

Chapter 2

Installation [GDL and Gendl]

Please follow Section 2.1 if your email address is registered with Genworks and you will install apre-packaged Genworks GDL distribution, including its own Common Lisp engine. The foundationof Genworks GDL is also available as open-source software through The Gendl Project1; if you electto use that version, then please refer to Section 2.2.

2.1 Installation of pre-packaged GDL

This section will take you through the installation of Genworks GDL from a prepackaged distribu-tion with the Allegro CL or LispWorks commercial Common Lisp engine and the Slime IDE (basedon Gnu Emacs).

2.1.1 Download the Software and retrieve a license key

1. Visit the Downloads section of the Genworks Website;

2. Enter your email address2;

3. Download the latest Payload for Windows, Linux, or Mac;

4. Click to receive the license key file by email.

2.1.2 Unpack the Distribution

Genworks GDL is currently distributed as a setup executable for Windows, a “dmg” applicationbundle for Mac, and a self-contained zip file for Linux.

• Run the installation executable. Accept the defaults when prompted.3

• Copy the license key file as gdl.lic (for Trial, Student, Professional editions), or devel.lic (forEnterprise edition) into the program/ directory within the gdl/gdl/program/ directory.

1http://github.com/genworks/gendl2if your address is not on file, send mail to [email protected] Linux, you have to install emacs and ghostscript yourself. Please use your distribution’s package manager to

complete this installation.

7

Page 14: Genworks GDL: A User's Manual - Genworks International

8 CHAPTER 2. INSTALLATION [GDL AND GENDL]

• Launch the application by finding the Genworks program group in the Start menu (Windows),or by double-clicking the application icon (Mac), or by running the run-gdl script (Linux).

2.2 Installation of open-source Gendl

This section is only germane if you have not received a pre-packaged Gendl or Genworks GDLdistribution with its own Common Lisp engine. If you have received a pre-packaged Gendl distri-bution then you may skip this section. In case you want to use the open-source Gendl, you willuse your own Common Lisp installation and obtain Gendl (Genworks-GDL) using a powerful andconvenient CL package/library manager called Quicklisp.

2.2.1 Install and Configure your Common Lisp environment

Gendl is currently tested to build on the following Common Lisp engines:

• Allegro CL (commercial product from Franz Inc, free Express Edition available)

• LispWorks (commercial product from LispWorks Ltd, free Personal Edition available)

• Clozure CL (free CL engine from Clozure Associates, free for all use)

• Steel Bank Common Lisp (SBCL) (free open-source project with permissive license)

Please refer to the documentation for each of these systems for full information on installingand configuring the environment. Typically this will include a text editor, either Gnu Emacs withSuperior Lisp Interaction Mode for Emacs (Slime), or a built-in text editing and developmentenvironment which comes with the Common Lisp system.

A convenient way to set up Emacs with Slime is to use the Quicklisp-slime-helper.

2.2.2 Load and Configure Quicklisp

Quicklisp is the defacto standard library manager for Common Lisp.

• Visit the Quicklisp website

• Follow the instructions there to download the quicklisp.lisp bootstrap file and load it toset up your Quicklisp environment.

2.2.3 Load and Start Gendl

invoke the following commands at the Common Lisp toplevel “repl” prompt:

1. (ql:quickload :gendl)

2. (gendl:start-gendl!)

Page 15: Genworks GDL: A User's Manual - Genworks International

2.3. SYSTEM TESTING 9

Figure 2.1: Robot displayed in Tasty

2.3 System Testing

2.3.1 Basic Sanity Test

You may test your installation using the following checklist. These tests are optional. You mayperform some or all of them in order to ensure that your Gendl is installed correctly and runningsmoothly. In your Web Browser (e.g. Google Chrome, Firefox, Safari, Opera, Internet Explorer),perform the following steps:

1. visit http://localhost:9000/tasty.

2. accept default robot:assembly.

3. Select “Add Leaves” from the Tree menu.

4. Click on the top node in the tree.

5. Observe the wireframe graphics for the robot as shown in 2.1.

6. Click on the robot to zoom in.

7. Select “Clear View!” from the View menu.

8. Select “X3DOM” from the View menu.

9. Click on the top node in the tree.

10. “Refresh” or “Reload” your browser window (may not be necessary).

Page 16: Genworks GDL: A User's Manual - Genworks International

10 CHAPTER 2. INSTALLATION [GDL AND GENDL]

Figure 2.2: Robot x3dom

11. If your browser supports WebGL, you will see the robot in shaded dynamic view as shown inFigure 2.2.

12. Select “PNG” from the View menu. You will see the wireframe view of the robot as a PNGimage.

13. Select “X3D” from the View menu. If your browser has an X3D plugin installed (e.g. BSContact), you will see the robot in a shaded dynamic view.

2.3.2 Full Regression Test

The following commands will invoke a full regression test, including a test of the Surface and Solidsprimitives provided by the SMLib geometry kernel. Note that the SMLib geometry kernel is onlyavailable with proprietary Genworks GDL licenses — therefore, if you have open-source Gendl ora lite Trial version of Genworks GDL, these regression tests will not all function.

In Emacs at the gdl-user prompt in the *slime-repl...* buffer, type the following com-mands:

1. (ql:quickload :regression)

2. (gdl-lift-utils::define-regression-tests)

3. (gdl-lift-utils::run-regression-tests-pass-fail)

4. (pprint gdl-lift-utils::*regression-test-report*)

Page 17: Genworks GDL: A User's Manual - Genworks International

2.4. GETTING HELP AND SUPPORT 11

2.4 Getting Help and Support

If you encounter unexplained errors in the installation and startup process, please contact thefollowing resources:

1. Make a posting to the Genworks Google Group

2. Join the #gendl IRC (Internet Relay Chat) channel on irc.freenode.net and discuss issuesthere.

3. For exclusively Common Lisp issues, join the #lisp IRC (Internet Relay Chat) channel onirc.freenode.net and discuss issues there.

4. Also for Common Lisp issues, follow the comp.lang.lisp Usenet group.

5. If you are a supported Genworks customer, send email to [email protected]

6. If you are not a supported Genworks customer but you want to report an apparent bug orhave other suggestions or inquiries, you may also send email to [email protected], but asa non-customer please understand that Genworks cannot guarantee a response or a particulartime frame for a response. Also note that we are not able to offer guaranteed support forTrial and Student licenses

Page 18: Genworks GDL: A User's Manual - Genworks International

12 CHAPTER 2. INSTALLATION [GDL AND GENDL]

Page 19: Genworks GDL: A User's Manual - Genworks International

Chapter 3

Basic Operation of the GDLEnvironment

This chapter will lead you through all the basic steps of operating a typical GDL-based developmentenvironment. We will not in this section go into particular depth about the additional features ofthe environment or language syntax — this chapter is merely to familiarize you with, and start youpracticing with the nuts and bolts of operating the environment with a keyboard.

3.1 What is Different about GDL?

GDL is a dynamic language environment with incremental compiling and in-memory definitions.This means that as long as the system is running you can compile new definitions of functions,objects, etc, and they will immediately become available as part of the running system, and you canbegin testing them immediately, or update an existing set of objects to observe their new behavior.

In many other programming language systems, to introduce a new function or object, one hasto start the system from the beginning and reload all the files in order to test new functionality.

In GDL, it is typical to keep the same development session up and running for an entire dayor longer, making it unnecessary to repeatedly recompile and reload your definitions from scratch.Note, however, that if you do shut down and restart the system for some reason, then you will haveto recompile and/or reload your application’s definitions in order to bring the system back into astate where it can instantiate (or “run”) your application.

While this can be done manually at the command-line, it is typically done automatically in oneof two ways:

1. Using commands placed into the gdlinit.cl initialization file, as described in Section 3.4.

2. Alternatively, you can compile and load definitions into your session, then save the “world”in that state. That way it is possible to start a new GDL “world” which already has all yourapplication’s definitions loaded and ready for use, without having to procedurally reload anyfiles. You can then begin to make and test new definitions (and re-definitions) starting fromthis new “world.” You can think of a saved “world” like pre-made cookie dough: no need toadd each ingredient one by one — just start making cookies!

13

Page 20: Genworks GDL: A User's Manual - Genworks International

14 CHAPTER 3. BASIC OPERATION OF THE GDL ENVIRONMENT

3.2 Startup, “Hello, World!” and Shutdown

The typical GDL environment consists of three programs:

1. Gnu Emacs (the editor);

2. a Common Lisp engine with GDL system loaded or built into it (e.g. the gdl.exe executablein your program/ directory); and

3. (optionally) a web browser such as Firefox, Google Chrome, Safari, Opera, or Internet Ex-plorer

Emacs runs as the main process, and this in turn starts the CL engine with GDL as a sub-process.The CL engine typically runs an embedded webserver, enabling you to access your applicationthrough a standard web browser.

As described in Chapter ??, the typical way to start a pre-packaged GDL environment is withthe run-gdl.bat (Windows), or run-gdl (MacOS, Linux) script files, or with the installed Startprogram item (Windows) or application bundle (MacOS). Invoke this script file from the Startmenu (Windows), your computer’s file manager, or from a desktop shortcut if you have createdone. Your installation executable may also have created a Windows “Start” menu item for GenworksGDL. You can of course also invoke run-gdl.bat from the Windows “cmd” command-line, or fromanother command shell such as Cygwin.1

3.2.1 Startup

Startup of a typical GDL development session consists of two fundamental steps: (1) starting theEmacs editing environment, and (2) starting the actual GDL process as a “sub-process” or “inferior”process within Emacs. The GDL process should automatically establish a network connection backto Emacs, allowing you to interact directly with the GDL process from within Emacs.

1. Invoke the run-gdl.bat, run-gdl.bat startup script, or the provided executable from theStart menu (windows) or application bundle (Mac).

2. You should see an emacs window similar to that shown in Figure 3.1. (alternative colors arealso possible).

3. (MS Windows): Look for the Genworks GDL Console window, or (Linux, Mac) use the Emacs“Buffer” menu to visit the “*inferior-lisp*” buffer. Note that the Genworks GDL Consolewindow might start as a minimized icon; click or double-click it to un-minimize.

4. Watch the Genworks GDL Console window for any errors. Depending on your specific instal-lation, it may take from a few seconds to several minutes for the Genworks GDL Console (or*inferior-lisp* buffer) to settle down and give you a gdl-user(): prompt. This window iswhere you will see most of your program’s textual output, any error messages, warnings, etc.

1Cygwin is also useful as a command-line tool on Windows for interacting with a version control system likeSubversion (svn).

Page 21: Genworks GDL: A User's Manual - Genworks International

3.2. STARTUP, “HELLO, WORLD!” AND SHUTDOWN 15

Figure 3.1: Startup of Emacs with GDL

Page 22: Genworks GDL: A User's Manual - Genworks International

16 CHAPTER 3. BASIC OPERATION OF THE GDL ENVIRONMENT

5. In Emacs, type: C-x & (or select Emacs menu item Buffers→*slime-repl...*) to visit the“*slime-repl ...*” buffer. The full name of this buffer depends on the specific CL/GDL plat-form which you are running. This buffer contains an interactive prompt, labeled gdl-user>,where you will enter most of your commands to interact with your running GDL session fortesting, debugging, etc. There is also a web-based graphical interactive environment calledtasty which will be discussed in Chapter 6.

6. To ensure that the GDL command prompt is up and running, type: (+ 2 3) and press[Enter].

7. You should see the result 5 echoed back to you below the prompt.

3.2.2 Developing and Testing a “Hello World” application

1. type C-x (Control-x) 2, or C-x 3, or use the “Split Screen” option of the File menu to splitthe Emacs frame into two “windows” (“windows” in Emacs are non-overlapping panels, orrectangular areas within the main Emacs window).

2. type C-x o several times to move from one window to the other, or move the mouse cursorand click in each window. Notice how the blinking insertion point moves from one windowto the other.

3. In the top (or left) window, type C-x C-f (or select Emacs menu item “File→Open File”) toget the “Find file” prompt in the mini-buffer.

4. Type C-a to move the point to the beginning of the mini-buffer line.

5. Type C-k to delete from the point to the end of the mini-buffer.

6. Type ~/hello.gdl and press [Enter]

7. You are now editing a (presumably new) file of GDL code, located in your HOME directory,called hello.gdl

8. Enter the text from Figure 3.2 into the hello.gdl buffer. You do not have to match theline breaks and whitespace as shown in the example. You can auto-indent each new line bypressing [TAB] after pressing [Enter] for the newline.

Protip:You can also try using C-j instead of [Enter], which will automatically give a newlineand auto-indent.

9. type C-x C-s (or choose Emacs menu item File→Save) to save the contents of the buffer (i.e.the window) to the file in your HOME directory.

10. type C-c C-k (or choose Emacs menu item SLIME→Compilation→Compile/Load File) tocompile & load the code from this file.

11. type C-c o (or move and click the mouse) to switch to the bottom window.

Page 23: Genworks GDL: A User's Manual - Genworks International

3.2. STARTUP, “HELLO, WORLD!” AND SHUTDOWN 17

(in-package :gdl-user)

(define-object hello ()

:computed-slots

((greeting "Hello, World!")))

Figure 3.2: Example of Simple Object Definition

12. In the bottom window, type C-x & (or choose Emacs menu item Buffers→*slime-repl...* ) toget the *slime-repl ...* buffer, which should contain a gdl-user> prompt. This is whereyou normally type interactive GDL commands.

13. If necessary, type M > (that is, hold down Meta (Alt), Shift, and the “>” key) to move theinsertion point to the end of this buffer.

14. At the gdl-user> prompt, type

(make-self ’hello)

and press [Enter].

15. At the gdl-user> prompt, type

(the greeting)

and press [Enter].

16. You should see the words Hello, World! echoed back to you below the prompt.

3.2.3 Shutdown

To shut down a development session gracefully, you should first shut down the GDL process, thenshut down your Emacs.

• Type M-x quit-gdl (that is, hold Alt and press X, then release both while you type quit-gdlin the mini-buffer), then press [Enter]

• alternatively, you can type C-x & (that is, hold Control and press X, then release both whileyou type &. This will visit the *slime-repl* buffer. Now type: , q to quit the GDL session.

• Finally, type C-x C-c to quit from Emacs. Emacs will prompt you to save any modifiedbuffers before exiting.

Page 24: Genworks GDL: A User's Manual - Genworks International

18 CHAPTER 3. BASIC OPERATION OF THE GDL ENVIRONMENT

apps/yoyodyne/booster-rocket/source/assembly.gdl

apps/yoyodyne/booster-rocket/source/package.gdl

apps/yoyodyne/booster-rocket/source/parameters.gdl

apps/yoyodyne/booster-rocket/source/rules.gdl

Figure 3.3: Example project directory with four source files

apps/yoyodyne/booster-rocket/source/assembly.gdl

apps/yoyodyne/booster-rocket/source/file-ordering.isc

apps/yoyodyne/booster-rocket/source/package.gdl

apps/yoyodyne/booster-rocket/source/parameters.gdl

apps/yoyodyne/booster-rocket/source/rules.gdl

Figure 3.4: Example project directory with file ordering configuration file

3.3 Working with Projects

GDL contains utilities which allow you to treat your application as a “project,” with the ability tocompile, incrementally compile, and load a “project” from a directory tree of source files represent-ing your project. In this section we provide an overview of the expected directory structure andavailable control files, followed by a reference for each of the functions included in the bootstrapmodule.

3.3.1 Directory Structure

You should structure your applications in a modular fashion, with the directories containing ac-tual Lisp sources called ”source.” You may have subdirectories which themselves contain ”source”directories. We recommend keeping your codebase directories relatively flat, however.

In Figure 3.3 is an example application directory, with four source files.

3.3.2 Source Files within a source/ subdirectory

Enforcing Ordering

Within a source subdirectory, you may have a file called file-ordering.isc2 to enforce a certainordering of the files. Here are the contents of an example for the above application:

("package" "parameters")

This will force package.lisp to be compiled/loaded first, and parameters.lisp to be compiled/loadednext. The ordering on the rest of the files should not matter (although it will default to lexigraphicalordering).

Now our sample application directory appears as in Figure 3.4.

2isc stands for “Intelligent Source Configuration”

Page 25: Genworks GDL: A User's Manual - Genworks International

3.4. CUSTOMIZING YOUR ENVIRONMENT 19

3.3.3 Generating an ASDF System

ASDF stands for Another System Definition Facility, which is the predominant system in use forCommon Lisp third-party libraries. With GDL, you can use the :create-asd-file? keywordargument to make cl-lite generate an ASDF system file instead of actually compiling and loadingthe system. For example:

(cl-lite "apps/yoyodyne/" :create-asd-file? t)

In order to include a depends-on clause in your ASDF system file, create a file called depends-on.isc

in the toplevel directory of your system. In this file, place a list of the systems your system dependson. This can be systems from your own local projects, or from third-party libraries. For example,if your system depends on the :cl-json third-party library, you would have the following contentsin your depends-on.isc:

(:cl-json)

3.3.4 Compiling and Loading a System

Once you have generated an ASDF file, you can compile and load the system using Quicklisp. Todo this for our example, follow these steps:

1. (cl-lite "apps/yoyodyne/" :create-asd-file? t)

to generate the asdf file for the yoyodyne system. This only has to be done once after everytime you add, remove, or rename a file or folder from the system.

2. (pushnew "apps/yoyodyne/" ql:*local-project-directories* :test #’equalp)

This can be done in your gdlinit.cl for projects you want available during every develop-ment session. Note that you should include the full path prefix for the directory containingthe ASDF system file.

3. (ql:quickload :gdl-yoyodyne)

This will compile and load the actual system. Quicklisp uses ASDF at the low level to compileand load the systems, and Quicklisp will retrieve any depended-upon third-party libraries fromthe Internet on-demand. Source files will be compiled only if the corresponding binary (fasl)file does not exist or is older than the source file. By default, ASDF keeps its binary files in acache directory, separated according to the CL platform and operating system. The locationof this cache is system-dependent, but you can see where it is by observing the compile andload process.

3.4 Customizing your Environment

You may customize your environment in several different ways, for example by loading definitionsand settings into your GDL “world” automatically when the system starts, and by specifying fonts,colors, and default buffers (to name a few) for your emacs editing environment.

Page 26: Genworks GDL: A User's Manual - Genworks International

20 CHAPTER 3. BASIC OPERATION OF THE GDL ENVIRONMENT

3.5 Saving the World

“Saving the world” refers to a technique of saving a complete binary image of your GDL “world”which contains all the currently compiled and loaded definitions and settings. This allows you tostart up a saved world almost instantly, without being required to reload all the definitions. Youcan then incrementally compile and load just the particular definitions which you are working onfor your development session.

To save a world, follow these steps:

1. Load the base GDL code and (optionally) code for GDL modules (e.g. gdl-yadd, gdl-tasty)you want to be in your saved image. Note that in some implementations, this has step to bedone in a plain session without multiprocessing (i.e. without an Emacs connection) - so youwould do this loading step from a command shell e.g. Windows cmd prompt. For example:

(ql:quickload :gdl-yadd)

(ql:quickload :gdl-tasty)

2. (needed only for full GDL):

(ff:unload-foreign-library (merge-pathnames "smlib.dll" "sys:smlib;"))

3. (net.aserve:shutdown)

4. (to save an image named yoyodyne.dxl) Invoke the command

(ensure-directories-exist "~/gdl-images/")

(uiop:dump-image dumplisp "~/gdl-images/yoyodyne")

Note that the standard extension for Allegro CL images is .dxl. Prepend the file name withpath information, to write the image to a specific location.

3.6 Starting up a Saved World

In order to start up GDL using a custom saved image, or “world,” follow these steps

1. Exit GDL

2. Copy the supplied image file, e.g.gdl.dxl to gdl-orig.dxl.

3. Move the custom saved dxl image to gdl.dxl in the GDL application "program/" directory.

4. Start GDL as usual. Note: you may have to edit the system gdlinit.cl or your home gdlinit.clto stop it from loading redundant code which is already in the saved image.

Page 27: Genworks GDL: A User's Manual - Genworks International

Chapter 4

Understanding Common Lisp

GDL is a superset of Common Lisp (CL) — that is, all of CL is available to you during development,and is available to your applications at runtime (i.e. after they are deployed). The lowest-levelexpressions in a GDL definition are CL “symbolic expressions,” or “S-expressions.” This chapterwill familiarize you with CL S-expressions.

4.1 S-expression Fundamentals

S-expressions can be used in a similar manner to Formulas in a Spreadsheet to establish the value ofa particular slot (i.e. named data value) in an object. However, unlike in a spreadsheet, these valuesare only computed on an as-needed basis (i.e. “on-demand”). You can also evaluate S-expressionsat the toplevel gdl-user> prompt, and see the result immediately. In fact, this toplevel promptis called a read-eval-print loop, because its purpose is to read each S-expression entered, evaluatethe expression to yield a result (or return-value), and finally to print that result.

CL S-expressions use a prefix notation, which means that they consist of either an atom (e.g.number, text string, symbol) or a list (one or more items enclosed by parentheses, where the firstitem is taken as a symbol which names an operator). Here is an example:

(+ 2 2)

This expression consists of the function named by the symbol +, followed by the numeric arguments2 and another 2. As you may have suspected, when this expression is evaluated it will return thevalue 4.Try it: try typing this expression at your command prompt, and see the return-valuebeing printed on the console. What is actually occurring here? When CL is asked to evaluate anexpression, it processes the expression according to the following rules:

• If the expression is an atom (e.g. a non-list datatype such as a number, text string, or literalsymbol), it simply returns itself as its evaluated value. Examples:

– gdl-user> 99

99

– gdl-user> 99.9

99.9

21

Page 28: Genworks GDL: A User's Manual - Genworks International

22 CHAPTER 4. UNDERSTANDING COMMON LISP

– gdl-user> 3/5

3/5

– gdl-user> "Bob"

"Bob"

– gdl-user> "Our golden rule is simplicity"

"Our golden rule is simplicity"

– gdl-user> ’my-symbol

my-symbol

Note that numbers are represented directly (with decimal points and slashes for fractionsallowed), strings are surrounded by double-quotes, and literal symbols are introduced witha preceding single-quote. Symbols are allowed to have dashes (“-”) and most other specialcharacters. By convention, the dash is used as a word separator in CL symbols.

• If the expression is a list (i.e. is surrounded by parentheses), CL processes the first element inthis list as an operator name, and the rest of the elements in the list represent the argumentsto the operator. An operator can take zero or more arguments, and can return zero or morereturn-values. Some operators evaluate their arguments immediately and work directly onthose values (these are called functions). Other operators expand into other code. Theseare called special operators or macros. Macros are what give Lisp (and CL in particular) itsspecial power. Here are some examples of functional S-expressions:

– gdl-user> (expt 2 5)

32

– gdl-user> (+ 2 5)

7

– gdl-user> (+ 2)

2

– gdl-user> (+ (+ 2 2) (+ 3 3 ))

10

4.2 Fundamental CL Data Types

As has been noted, Common Lisp natively supports many data types1 common to other languages,such as numbers and text strings. CL also contains several compound data types such as lists,arrays, and hash tables. CL contains symbols as well, which typically are used as names for otherdata elements.

Regarding data types, CL follows a system called dynamic typing. Basically this means thatvalues have type, but variables do not necessarily have type, and typically variables are not “pre-declared” to be of a particular type. For example, a variable (or slot name in GDL) called length

could contain a value 42 (an integer), 42.43 (a floating-point number), 3/16 (a rational number),or even :long (a descriptive keyword symbol).

1See http://en.wikipedia.org/wiki/Data type for a more detailed discussion of what is meant by “data types” inthis context.

Page 29: Genworks GDL: A User's Manual - Genworks International

4.2. FUNDAMENTAL CL DATA TYPES 23

4.2.1 Numbers

As observed, numbers in CL are a native data type which simply evaluate to themselves whenentered at the toplevel or included in an expression.

Numbers in CL form a hierarchy of types, which includes Integers, Ratios, Floating Point,and Complex numbers. For many purposes, you only need to think of a value as a “number”without getting any more specific than that. Most arithmetic operations, such as +, -, *, / etc,will automaticaly do any necessary type-coercion on their arguments and will return a number ofthe appropriate type.

CL supports a full range of floating-point decimal numbers, as well as true Ratios, which meansthat, for example, 1/3 is a true one-third, not 0.333333333 rounded off at some arbitrary precisionshort of infinity.

4.2.2 Strings

Strings are actually a specialized kind of array, namely a one-dimensional array (vector) made upof text characters. These characters can be letters, numbers, or punctuation, and in some casescan include characters from international character sets (e.g. Unicode or UTF-8) such as ChineseHanzi or Japanese Kanji. The string delimiter in CL is the double-quote character.

Text strings in CL are a native data type which simply evaluate to themselves when includedin an expression.

A common way to produce a string in CL is with the format function. Although the formatfunction can be used to send output to any kind of destination, or stream, it will simply yield astring if you specify nil for the stream. Example:

gdl-user> (format nil "The time is: ~a" (get-universal-time))

"The time is: 3564156603"

gdl-user> (format nil "The time is: ~a" (iso-8601-date (get-universal-time)))

"The time is: 2012-12-10"

gdl-user> (format nil "The time is: ~a" (iso-8601-date (get-universal-time) :include-time? t))

"The time is: 2012-12-10T14:30:17"

As the above example demonstrates, format takes a stream designator or nil as its first argu-ment, then a format-string, then enough arguments to match the format directives in the format-string. Format directives begin with the tilde character ()̃. The format-directive a indicatesthat the printed representation of the corresonding argument should simpy be substituted into theformat-string at the point where it occurs.

We will cover more details on format in Section ?? on Input/Output, but for now, a familiaritywith the simple use of (format nil ...) will be helpful for Chapter 5.

4.2.3 Symbols

Symbols are such an important data structure in CL that people sometimes refer to CL as a“Symbolic Computing Language.” Symbols are a type of CL object which provides your programwith a built-in capacity to store and retrieve values and functions, as well as being useful in theirown right. A symbol is most often known by its name (actually a string), but in fact there is muchmore to a symbol than its name. In addition to the name, symbols also contain a function slot,

Page 30: Genworks GDL: A User's Manual - Genworks International

24 CHAPTER 4. UNDERSTANDING COMMON LISP

a value slot, and an open-ended property-list slot in which you can store an arbitrary number ofnamed properties.

For a named function such as + the function-slot contains the actual function object for per-forming numeric addition. The value-slot of a symbol can contain any value, allowing the symbolto act as a global variable, or parameter. And the property-list, also known as the plist slot, cancontain an arbitrary amount of information.

This separation of the symbol data structure into function, value, and plist slots is one funda-mental distinction between Common Lisp and most other Lisp dialects. Most other dialects allowonly one (1) “thing” to be stored in the symbol data structure, other than its name (e.g. either afunction or a value, but not both at the same time). Because Common Lisp does not impose thisrestriction it is not necessary to contrive names, for example for your variables, to avoid conflictingwith existing “reserved words” in the system. For example, list is the name of a built-in functionin CL, but you may freely use list as a variable name as well. There is no need to contrivearbitrary abbreviations such as lst.

How symbols are evaluated depends on where they are located in an expression. As we haveseen, if a symbol appears first in a list expression, as with the + in (+ 2 2), the symbol is evaluatedfor its function slot. If the first element of an expression indeed has an identified function in itsfunction slot, then any subsequent symbol in the expression is taken as a variable, and it is evaluatedfor its global or local value, depending on its scope (more on variables and scope later).

As noted in Section 3.1.3, if you want a literal symbol itself, one way to achieve this is to “quote”the symbol name:

’a

Another way is for the symbol to appear within a quoted list expression, for example:

’(a b c)

or

’(a (b c) d)

Note that the quote (’) applies across everything in the list expression, including any sub-expressions.

4.2.4 List Basics

Lisp derives its name from its strong support for the list data structure. The list concept is impor-tant to Common Lisp (CL) for more than this reason alone — most notably, lists are importantbecause all CL programs are themselves lists.

Having the list as a native data structure, as well as the form of all programs, means that itis straightforward for CL programs to compute and generate other CL programs. Likewise, CLprograms can read and manipulate other CL programs in a natural manner. This cannot be said ofmost other languages, and is one of the primary distinguishing characteristics of Lisp as a language.

Textually, a list is defined as zero or more items surrounded by parentheses. The items canbe objects of any valid CL data types, such as numbers, strings, symbols, lists, or other kinds ofobjects. According to standard evaluation rules, you must quote a literal list to evaluate it as such,or CL will assume you are calling a function. Now look at the following list:

Page 31: Genworks GDL: A User's Manual - Genworks International

4.2. FUNDAMENTAL CL DATA TYPES 25

(defun hello () (write-string "Hello, World!"))

This list also happens to be a valid CL program (function definition, in this case). Don’t concernyourself about analyzing the function definition right now, but do take a few moments to convinceyourself that it meets the requirements for a list.

What are the types of the elements in this list?2

In addition to using the quote (’) to produce a literal list, another way to produce a list is tocall the function list. The function list takes any number of arguments, and returns a list madeup from the result of evaluating each argument. As with all functions, the arguments to the list

function get evaluated, from left to right, before being processed by the function. For example:

(list ’a ’b (+ 2 2))

will return the list

(a b 4)

The two quoted symbols evaluate to symbols, and the function call (+ 2 2) evaluates to the number4.

4.2.5 The List as a Data Structure

In this section we will discuss a few of the fundamental native CL operators for manipulating listsas data structures. These include operators for doing things such as:

1. finding the length of a list;

2. accessing particular members of a list;

3. appending multiple lists together to make a new list.

Finding the Length of a List

The function length will return the length of any type of sequence, including a list:

gdl-user> (length ’(a b c d e f g h i j)

10

gdl-user> (length nil)

0

Note that nil qualifies as a list (albeit the empty list), so taking its length yields the integer 0.

2Answer: symbol, symbol, (empty) list, list with symbol and string.

Page 32: Genworks GDL: A User's Manual - Genworks International

26 CHAPTER 4. UNDERSTANDING COMMON LISP

Accessing the Elements of a List

Common Lisp defines the accessor functions first through tenth as a means of accessing the firstten elements in a list:

gdl-user> (first ’(a b c))

a

gdl-user> (second ’(a b c))

b

gdl-user> (third ’(a b c))

c

For accessing elements in an arbitrary position in the list, you can use the function nth, which takesan integer and a list as its two arguments:

gdl-user> (nth 0 ’(a b c))

a

gdl-user> (nth 1 ’(a b c))

b

gdl-user> (nth 2 ’(a b c))

c

Note that nth starts its indexing at zero (0), so (nth 0 ...) is equivalent to (first ...)and(nth 1 ...) is equivalent to (second ...), etc.

Using a List to Store and Retrieve Named Values

Lists can also be used to store and retrieve named values. When a list is used in this way, it iscalled a plist. Plists contain pairs of elements, where each pair consists of a key and some value.The key is typically an actual keyword symbol — that is, a symbol preceded by a colon (:). Thevalue can be any value, such as a number, a string, or even a GDL object representing somethingcomplex such as an aircraft.

A plist can be constructed in the same manner as any list, e.g. with the list operator:

(list :a 10 :b 20 :c 30)

Page 33: Genworks GDL: A User's Manual - Genworks International

4.3. SUMMARY 27

In order to access any element in this list, you can use the getf operator. The getf operator isspecially intended for use with plists:

gdl-user> (getf (list :a 10 :b 20 :c 30) :b

20

gdl-user> (getf (list :a 10 :b 20 :c 30) :c

30

Common Lisp contains several other data structures for mapping keywords or numbers to values,such as arrays and hash tables. But for relatively short lists, and especially for rapid prototypingand testing work, plists can be useful. Plists can also be written and read (i.e. saved and restored)to and from plain text files in your filesystem, in a very natural way.

Appending Lists

The function append takes any number of lists, and returns a new list which results from appendingthem together. Like many CL functions, append does not side-effect. That is, it simply returns anew list as a return-value, but does not modify its arguments in any way:

gdl-user> (defparameter my-slides ’(introduction welcome lists functions))

(introduction welcome lists functions)

gdl-user> (append my-slides ’(numbers))

(introduction welcome lists functions numbers)

gdl-user> my-slides

(introduction welcome lists functions)

Note that the simple call to append does not affect the variable my-slides. Later we will observehow one may alter the value of a variable such as my-slides.

4.3 Summary

In this chapter we have presented enough basics of Lisp’s minimal syntax, and some particularsof Common Lisp, to enable you to start with the Genworks GDL framework. In keeping with thedemand-driven philosophy of GDL, subsequent chapters will cover additional CL material on anas-needed basis.

Page 34: Genworks GDL: A User's Manual - Genworks International

28 CHAPTER 4. UNDERSTANDING COMMON LISP

Page 35: Genworks GDL: A User's Manual - Genworks International

Chapter 5

Understanding GDL — Core GDLSyntax

Now that you have a basic familiarity with Common Lisp syntax (or, more accurately, the absenceof syntax), we will move directly into the Genworks GDL framework. By using GDL you canformulate most of your engineering and computing problems in a natural way, without becominginvolved in the complexity of the Common Lisp Object System (CLOS).

As discussed in the previous chapter, GDL is based on and is a superset of ANSI CommonLisp. Because ANSI CL is unencumbered and is an open standard, with several commercial andfree implementations, it is a good wager that applications written in it will continue to be usablefor the balance of this century, and beyond. Many commercial products have a shelf life only untila new product comes along. Being based in ANSI Common Lisp ensures GDL’s permanence.

[The GDL product is a commercially available KBE system with Proprietary licensing. TheGendl Project is an open-source Common Lisp library which contains the core language kernel ofGDL, and is licensed under the terms of the Affero Gnu Public License. The core GDL languageis a proposed standard for a vendor-neutral KBE language.]

5.1 Defining a Working Package

In Common Lisp, packages are a mechanism to separate symbols into namespaces. Using packagesit is possible to avoid “naming” conflicts in large projects. Consider this analogy: in the UnitedStates, telephone numbers are preceded by a three-digit area code and then consist of a seven-digitnumber. The same seven-digit number can occur in two or more separate area codes, withoutcausing a conflict.

The macro gdl:define-package is used to set up a new working package in GDL.Example:

(gdl:define-package :yoyodyne)

will establish a new package (i.e. “area code”) called :yoyodyne which has all the GDL operatorsavailable.

The :gdl-user package is an empty, pre-defined package for your use if you do not wish tomake a new package just for scratch work.

29

Page 36: Genworks GDL: A User's Manual - Genworks International

30 CHAPTER 5. UNDERSTANDING GDL — CORE GDL SYNTAX

For real projects it is recommended that you make and work in your own GDL package, definedas above with gdl:define-package.

A Note for advanced users: Packages defined with gdl:define-package will implicitly use the:gdl package and the :common-lisp package, so you will have access to all exported symbols inthese packages without prefixing them with their package name.

You may extend this behavior, by calling gdl:define-package and adding additional packagesto use with (:use ...). For example, if you want to work in a package with access to GDLoperators, Common Lisp operators, and symbols from the :cl-json package 1, you could set it upas follows:

(ql:quickload :cl-json)

(gdl:define-package :yoyodyne (:use :cl-json))

The first form ensures that the cl-json code module is actually fetched and loaded. The secondform defines a package with the :cl-json operators available to it.

5.2 Define-Object

Define-object is the basic macro for defining objects in GDL. An object definition maps directlyinto a Lisp (CLOS) class definition.

The define-object macro takes three basic arguments:

• a name, which is a symbol;

• a mixin-list, which is a list of symbols naming other objects from which the current objectwill inherit characteristics;

• a specification-plist, which is spliced in (i.e. doesn’t have its own surrounding parentheses)after the mixin-list, and describes the object model by specifying properties of the object(messages, contained objects, etc.) The specification-plist typically makes up the bulk of theobject definition.

Here are descriptions of the most common keywords making up the specification-plist:

input-slots specify information to be passed into the object instance when it is created.

computed-slots are actually cached methods, with expressions to compute and return a value.

objects specify other instances to be “contained” within this instance.

functions are (uncached) functions “of” the object, i.e. they operate just as normal CL functions,and accept arguments just like normal CL functions, with the added feature that you canalso use the referencing, to refer to messages or reference chains which are available to thecurrent object.

Page 37: Genworks GDL: A User's Manual - Genworks International

5.3. MAKING INSTANCES AND SENDING MESSAGES 31

(define-object hello ()

:input-slots (first-name last-name)

:computed-slots

((greeting (format nil "Hello, ~a ~a!!"

(the first-name)

(the last-name)))))

Figure 5.1: Example of Simple Object Definition

Figure 5.1 shows a simple example, which contains two input-slots, first-name and last-name,and a single computed-slot, greeting. A GDL Object is analogous in some ways to a CL defun,where the input-slots are like arguments to the function, and the computed-slots are like return-values. But seen another way, each slot in a GDL object serves as function in its own right.

The referencing macro the shadows CL’s the (which is a seldom-used type declaration operator).The in GDL is a macro which is used to reference the value of other messages within the same objector within contained objects. In the above example, we are using the to refer to the values of themessages (input-slots) named first-name and last-name.

Note that messages used with the are given as symbols. These symbols are unaffected by thecurrent Lisp *package*, so they can be specified either as plain unquoted symbols or as keywordsymbols (i.e. preceded by a colon), and the the macro will process them appropriately.

5.3 Making Instances and Sending Messages

Once we have defined an object, such as the example above, we can use the constructor functionmake-object in order to create an instance of it. Instance, in this context, means a single occurenceof the object with tangible values assigned to its input-slots. By way of analogy: an object definitionis like a blueprint for a house; an instance is like an actual house. The make-object function is verysimilar to the CLOS make-instance function. Here we create an instance of hello with specifiedvalues for first-name and last-name (the required input-slots), and assign this instance as thevalue of the symbol my-instance:

GDL-USER(16): (setq my-instance

(make-object ’hello :first-name "John"

:last-name "Doe"))

#<HELLO @ #x218f39c2>

Note that keyword symbols are used to “tag” the input values. And the return-value of make-objectis an instance of class hello. Now that we have an instance, we can use the operator the-objectto send messages to this instance:

1CL-JSON is a free third-party library for handling JSON format, a common data format used for Internetapplications.

Page 38: Genworks GDL: A User's Manual - Genworks International

32 CHAPTER 5. UNDERSTANDING GDL — CORE GDL SYNTAX

GDL-USER(17): (the-object my-instance greeting)

"Hello, John Doe!!"

The-object is similar to the, but as its first argument it takes an expression which evaluates toan object instance. The, by contrast, assumes that the object instance is the lexical variable self,which is automatically set within the lexical context of a define-object.

Like the, the-object evaluates all but the first of its arguments as package-immune symbols,so although keyword symbols may be used, this is not a requirement, and plain, unquoted symbolswill work just fine.

For convenience, you can also set self manually at the CL Command Prompt, and use the

instead of the-object for referencing:

GDL-USER(18): (setq self

(make-object ’hello :first-name "John"

:last-name "Doe"))

#<HELLO @ #x218f406a>

GDL-USER(19): (the greeting)

"Hello, John Doe!!"

In actual fact, (the ...) simply expands into (the-object self ...).

5.4 Objects

The :objects keyword specifies a list of “contained” instances, where each instance is consideredto be a “child” object of the current object. Each child object is of a specified type, which itselfmust be defined with define-object before the child object can be instantiated.

Inputs to each instance are specified as a plist of keywords and value expressions, spliced inafter the object’s name and type specification. These inputs must match the inputs protocol (i.e.the input-slots) of the object being instantiated. Figure 5.2 shows an example of an object whichcontains some child objects. In this example, hotel and bank are presumed to be already (or soonto be) defined as objects themselves, which each answer the water-usage message. The referencechains:

(the hotel water-usage)

and

(the bank water-usage)

provide the mechanism to access messages within the child object instances.

These child objects become instantiated on demand, which means that the first time theseinstances, or any of their messages, are referenced, the actual instance will be created and cachedfor future reference.

Page 39: Genworks GDL: A User's Manual - Genworks International

5.4. OBJECTS 33

(define-object city ()

:computed-slots

((total-water-usage (+ (the hotel water-usage)

(the bank water-usage))))

:objects

((hotel :type ’hotel

:size :large)

(bank :type ’bank

:size :medium)))

Figure 5.2: Object Containing Child Objects

(defparameter *presidents-data*

’((:name

"Carter"

:term 1976)

(:name "Reagan"

:term 1980)

(:name "Bush"

:term 1988)

(:name "Clinton"

:term 1992)))

(define-object presidents-container ()

:input-slots

((data *presidents-data*))

:objects

((presidents :type ’president

:sequence (:size (length (the data)))

:name (getf (nth (the-child index) (the data)) :name)

:term (getf (nth (the-child index) (the data)) :term))))

Figure 5.3: Sample Data and Object Definition to Contain U.S. Presidents

Page 40: Genworks GDL: A User's Manual - Genworks International

34 CHAPTER 5. UNDERSTANDING GDL — CORE GDL SYNTAX

5.5 Sequences of Objects and Input-slots with a Default Expres-sion

Objects may be sequenced , to specify, in effect, an array or list of object instances. The mostcommon type of sequence is called a fixed size sequence. See Figure 5.3 for an example of an objectwhich contains a sequenced set of instances representing successive U.S. presidents. Each memberof the sequenced set is fed inputs from a list of plists, which simulates a relational database table(essentially a “list of rows”).

Note the following from this example:

• In order to sequence an object, the input keyword :sequence is added, with a list consistingof the keyword :size followed by an expression which must evaluate to a number.

• In the input-slots, data is specified together with a default expression. Used this way, input-slots function as a hybrid of computed-slots and input-slots, allowing a default expression aswith computed-slots, but allowing a value to be passed in on instantiation or from the parent,as with an input-slot which has no default expression. A passed-in value will override thedefault expression.

5.6 Summary

This chapter has provided an introduction to the core GDL syntax. As with any language, practice(that is, usage) makes perfect. The chapters that follow will cover more specialized aspects of theGDL language, introducing additional Common Lisp concepts as they are required along the way.

Page 41: Genworks GDL: A User's Manual - Genworks International

Chapter 6

The Tasty Development Environment

Tasty1 is a web based testing and tracking utility. Note that Tasty is designed for developers ofGDL applications — that is, it is not intended as an end-user application interface (see Chapter 8for the recommended steps to create end-user interfaces).

Tasty allows one to visualize and inspect any object defined in GDL which mixes at leastbase-object into the definition of its root2

First, make sure you have compiled and loaded the code for the Chapter 5 examples, containedin

.../src/documentation/tutorial/examples/chapter-5/

in your GDL distribution. If you are not sure how to do this, you may want to leave this sectiontemporarily and review Chapter 3, and then return.

Now you should have the Chapter 5 example definitions compiled and loaded into the system.To access Tasty, point your web browser to the URL in figure 6.1. This will produce the start-uppage, as seen in Figure 6.23. To access an instance of a specific object definition, you specify theclass package and the object type, separated by a colon (“:”) (or a double-colon (“::”) in the eventthe symbol naming the type is not exported from the package). For example, consider the simple

1“Tasty” is an acronym of acronyms - it stands for TAtu with STYle (sheets), where tatu comes from TestingAnd Tracking Utility.

2base-object is the core mixin for all geometric objects and gives them a coordinate system, length, width, andheight. This restriction in Tasty will be eliminated in a future GDL release so the user will be able to instantiatenon-geometric root-level objects in Tasty as well, for example to inspect objects which generate a web page but nogeometry.

3This page may look slightly different, e.g. different icon images, depending on your specific GDL version.

http://<host>:<port>/tasty

;; for example:

http://localhost:9000/tasty

Figure 6.1: Web Browser address for Tasty development environment

35

Page 42: Genworks GDL: A User's Manual - Genworks International

36 CHAPTER 6. THE TASTY DEVELOPMENT ENVIRONMENT

Figure 6.2: Tasty start-up

tower1 definition in Figure ??. This definition is in the :chapter-5 package. Consequently, thespecification will be chapter-5:tower1

Note that if the assembly symbol had not been exported from the :chapter-5 package, thena double-colon would have been needed: chapter-5::tower14

After you specify the class package and the object type and press the “browse” button, thebrowser will produce the Tasty interface with an instance of the specified type (see figure ??).The utility interface by default is composed of three toolbars and three view frames (tree frame,inspector frame and viewport frame “graphical view port”).

6.0.1 The Toolbars

The first toolbar consists of two “tabs” which allow the user to select between the display of theapplication itself or the GDL reference documentation.

The second toolbar is designed to select various “click modes” for objects and graphical viewing,and to customize the interface in other ways. It hosts five menus: edit, tree, view, windows andhelp5.

The tree menu allows the user to customize the “click mode” of the mouse (or “tap mode” forother pointing devices) for objects in the tree, inspector, or viewport frames. The behavior followsthe select-and-match behavior – you first select a mode of operation with one of the buttons or menuitems, then match that mode to any object in the tree frame or inspector frame by left-clicking (ortapping). These modes are as follows:

4use of a double-colon indicates dubious coding practice, because it means that the code in quesion is accessingthe “internals” or “guts” of another package, which may not have been the intent of that other package’s designer.

5A File menu will be added in a future release, to facilitate saving and restoring of instance “snapshots” — atpresent, this can be done programmatically.

Page 43: Genworks GDL: A User's Manual - Genworks International

37

• Tree: Graphical modes

Add Node (AN) Node in graphics viewport

Add Leaves (AL) Add Leaves in graphics viewport

Add Leaves indiv. (AL*) Add Leaves individually (so they can be deleted individually).

Draw Node (DN) Draw Node in graphics view port (replacing any existing).

Draw Leaves (DL) Draw Leaves in graphics view port (replacing any existing).

Clear Leaves (DL) Delete Leaves

• Tree: Inspect & debug modes

Inspect object (I) Inspect (make the inspector frame to show the selected object).

Set self to Object (B) Sets a global self variable to the selected object, so you can in-teract by sending messages to the object at the command prompt e.g. by typing (the

length) or (the children).

Set Root to Object (SR) Set displayed root in Tasty tree to selected object.

Up Root (UR!) Set displayed root in Tasty tree up one level (this is grayed out if alreadyon root).

Reset Root (RR!) Reset displayed root in Tasty to to the true root of the tree (this isgrayed out if already on root).

• Tree: frame navigation modes

Expand to Leaves (L) Nodes expand to their deepest leaves when clicked.

Expand to Children (C) Nodes expand to their direct children when clicked.

Auto Close (A) When any node is clicked to expand, all other nodes close automatically.

Remember State (R) Nodes expand to their previously expanded state when clicked.

• View: Viewport Actions

Fit to Window! Fits to the graphics viewport size the displayed objects (use after a Zoom)

Clear View! (CL!) Clear all the objects displayed in the graphics viewport.

• View: Image Format

PNG Sets the displayed format in the graphics viewport to PNG (raster image with isopara-metric curves for surfaces and brep faces).

JPEG Sets the displayed format in the graphics viewport to JPEG (raster image withisoparametric curves for surfaces and brep faces).

VRML/X3D Sets the displayed format in the graphics viewport to VRML with defaultlighting and viewpoint (these can be changed programmatically). This requires a com-patible plugin such as BS Contact

Page 44: Genworks GDL: A User's Manual - Genworks International

38 CHAPTER 6. THE TASTY DEVELOPMENT ENVIRONMENT

X3DOM This experimental mode sets the displayed format in the graphics viewport touse the x3dom.js Javascript library, which attempts to render X3D format directly in-browser without the need for plugins. This works best in WebGL-enabled browsers suchas a recent version of Google Chrome6.

SVG/VML Sets the displayed format in the graphics viewport to SVG/VML7, which is avector graphics image format displaying isoparametric curves for surfaces and brep faces.

• View: Click Modes

Zoom in Sets the mouse left-click in the graphics viewport to zoom in.

Zoom out Sets the mouse left-click in the graphics viewport to zoom out.

Measure distance Calculates the distance between two selected points from the graphicsviewport.

Get coordinates Displays the coordinates of the selected point from the graphics viewport.

Select Object Allows the user to select an object from the graphics viewport (currentlyworks for displayed curves and in SVG/VML mode only).

• View: Perspective

Trimetric Sets the displayed perspective in the graphics viewport to trimetric.

Front Sets the displayed perspective in the graphics viewport to Front (negative Y axis).

Rear Sets the displayed perspective in the graphics viewport to Rear (positive Y axis).

Left Sets the displayed perspective in the graphics viewport to Left (negative X axis).

Right Sets the displayed perspective in the graphics viewport to Right (positive X axis).

Top Sets the displayed perspective in the graphics viewport to Top (positive Z axis).

Bottom Sets the displayed perspective in the graphics viewport to Bottom (negative Z axis).

The third toolbar hosts the most frequently used buttons. These buttons have tooltips whichwill pop up when you hover the mouse over them. However, these buttons are found in the secondtoolbar as well, except for line thickness and color buttons. The line thickness and color buttons8

expand and contract when clicked, and allows the user to select a desired line thickness and colorfor the objects displayed in the graphics viewport.

6.0.2 View Frames

The tree frame contains a hierarchical representation of your defined object. For example for thetower assembly this will be as depicted in figure ??

To draw the graphics (geometry) for the tower leaf-level objects, you can select the “AddLeaves (AL)” item from the Tree menu, then click the desired leaf to be displayed from the tree.

6Currently, it is necessary to “Reload” or “Refresh” the browser window to display the geometry in this mode.7For complex objects with many display curves, SVG/VML can overwhelm the JavaScript engine in the web

browser. Use PNG for these cases.8The design of the line thickness and color buttons is being refined and may appear differently in your installation.

Page 45: Genworks GDL: A User's Manual - Genworks International

39

Alternatively, you can select the “rapid” button from the third toolbar which is symbolized by apencil icon. Because this operation (draw leaves) is frequently used, the operation is also directlyavailable as a direct-click icon which will appear when you hover the mouse over any leaf or nodein the tree.

A direct-click icon is also available for “inspect object,” as the second icon when you hover themouse over a leaf or node.

The “inspector” frame allows the user to inspect (and in some cases modify) the object instancebeing inspected.

For example, we can make the number-of-blocks of the tower to be “settable,” by addingthe keyword :settable after its default expression (please look ahead to Chapter ?? if you areinterested in more details on this GDL syntax). We will also pass in the number-of-blocks as the:size of the blocks sequence, rather than using a hard-coded value as previously. The new assemblydefinition is now:

;;

;; FLAG -- insert verbatim or ref to new tower code

;;

In this new version of the tower, the number-of-blocks is a settable slot, and its value can bemodified (i.e. “bashed”) as desired, either programmatically from the command-line, in an end-userapplication, or from the Tasty environment.

To modify the value in Tasty: select “Inspect” mode from the Tree menu, then select the rootof the assembly tree to set the inspector on that object (see Figure ??). Once the inspector isdisplaying this object, it is possible to expand its settable slots by clicking on the “Show Settables!”link (use the “X” link to collapse the settable slots view). When the settable slots area is open,the user may set the values as desired by inputting the new value and pressing the OK button (seeFigure ??).

Page 46: Genworks GDL: A User's Manual - Genworks International

40 CHAPTER 6. THE TASTY DEVELOPMENT ENVIRONMENT

Page 47: Genworks GDL: A User's Manual - Genworks International

Chapter 7

Working with Geometry in GDL

Although Genworks GDL is a powerful framework for a variety of general-purpose undertakings, oneof its particular strong points is generating geometry and processing geometric entities. Geometriccapabilities are provided by a library of low-level primitives, or LLPs. LLPs are pre-defined GDLobjects which you can extend by “mixing in” with your own definitions, and/or instantiate as childobjects in your definitions.

The names of the geometric LLPs are in the :geom-base package, and here are some examples:

• base-coordinate-system provides an empty 3D Cartesian coordinate system.1

• Simple 2-dimensional primitives include line, arc, and ellipse.

• Simple 3-dimensional primitives include box, sphere, and cylinder.

• Advanced 3-dimensional primitives (which depend on optional add-on Geometry Kernel mod-ule) include b-spline-curve, b-spline-surface, and merged-solid.

This chapter will cover the default coordinate system of GDL as well as the built-in simple 2Dand 3D LLPs. Chapter ?? will cover the advanced Surfaces and Solids primitives.

7.1 The Default Coordinate System in GDL

GDL’s default coordinate system comes with the standard mixin base-coordinate-system andrepresents a standard three-dimensional Cartesian Coordinate system with X, Y, and Z dimensions.

Figure 7.1 shows the coordinate system in a 3D Trimetric view.Figure 7.2 shows the coordinate system in a Front View.Figure 7.3 shows the coordinate system in a Top View.Figure 7.4 shows each face of the reference box labeled with its symbolic direction:

• Right for the positive X direction

• Left for the negative X direction

• Rear for the positive Y direction

1base-coordinate-system is also known by its legacy name base-object

41

Page 48: Genworks GDL: A User's Manual - Genworks International

42 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.1: Coordinate System in Trimetric View

Figure 7.2: Coordinate System in Front View

Page 49: Genworks GDL: A User's Manual - Genworks International

7.1. THE DEFAULT COORDINATE SYSTEM IN GDL 43

Figure 7.3: Coordinate System in Top View

Figure 7.4: Coordinate System with Symbolically Labeled Faces

Page 50: Genworks GDL: A User's Manual - Genworks International

44 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

(in-package :gdl-user)

(define-object box-assembly-1 (base-object)

:computed-slots ((length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+)))

:objects ((box :type ’box)))

Figure 7.5: Definition of a Box

• Front for the negative Y direction

• Top for the positive Z direction

• Bottom for the negative Z direction

7.2 Building a Geometric GDL Model from LLPs

The simplest geometric entity in GDL is a box, and in fact all entities are associated with animaginary reference box which shares the same slots as a normal box. The box primitive type inGDL inherits its inputs from base-coordinate-system, and the fundamental inputs are:

• center Default: #(0.0 0.0 0.0)

• orientation Default: nil

• height Default: 0

• length Default: 0

• width Default: 0

Figure 7.5 defines an example box, and Figure 7.6 demonstrates how it will display in Tasty.

Note the following from the example in 7.5:

• The symbol +phi+2 holds a global constant containing the “golden ratio” number, which isapproximated as 1.618.

• The slots length, width, and height are defined in base-object as trickle-down-slots. Forthis reason they are automatically being passed down into into the box child object. Thereforeit is not necessary to pass them down explicitly.

Page 51: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 45

Figure 7.6: Simple box displayed in Tasty

(in-package :gdl-user)

(define-object positioned-boxes (base-object)

:computed-slots ((length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+)))

:objects ((box-1 :type ’box)

(box-2 :type ’box

:center (make-point (the width) 0 0))))

Figure 7.7: Positioned Boxes source

Page 52: Genworks GDL: A User's Manual - Genworks International

46 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.8: Positioned Boxes

Page 53: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 47

(in-package :gdl-user)

(define-object positioned-by-index (base-object)

:input-slots ((number-of-boxes 5))

:computed-slots ((length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+)))

:objects ((boxes :type ’box

:sequence (:size (the number-of-boxes))

:center (make-point (* (the width) (the-child index))

0 0))))

Figure 7.9: Positioned by Index source

7.2.1 Positioning a child object using the center input

By default, a child object will be positioned at the same center as its parent, and the center

defaults to the point #(0.0 0.0 0.0). Figure 7.7 (rendered in Figure 7.8) shows a second boxbeing positioned adjacent to the first, by using the :center input.

7.2.2 Positioning Sequence Elements using (the-child index)

When specifying a sequence of child objects, each individual sequence element can be referencedfrom within its :objects section using the operator the-child. By using the-child to send theindex message, you can obtain the index3 of each individual child object as it is being processed.In this manner it is possible to compute a distinct position for each child, as a function of its index,as demonstrated in Figures 7.9 and 7.10.

7.2.3 Relative positioning using the translate operator

It is usually preferable to position child objects in a relative rather than absolute manner withrespect to the parent. For example, in our positioned-by-index example in Figure 7.9, each childbox object is being positioned using an absolute coordinate produced by make-point. This willwork as long as the center of the current parent is #(0.0 0.0 0.0) (which it is, by default). Butimagine if this parent itself is a child of a larger assembly. Imagine further that the larger assemblyspecifies a non-default center for this instance of positioned-by-index. At this point, the strategyfails.

2By convention, constants in Common Lisp are named with a leading and trailing + as a way to make themrecognizable as constants.

3Indices in GDL “size” sequences are integers which start with 0 (zero).

Page 54: Genworks GDL: A User's Manual - Genworks International

48 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.10: Positioned by Index

Page 55: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 49

(in-package :gdl-user)

(define-object translate-by-index (base-object)

:input-slots ((number-of-boxes 5))

:computed-slots ((length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+)))

:objects ((boxes :type ’box

:sequence (:size (the number-of-boxes))

:center (translate (the center)

:right (* (the width) (the-child index))))))

Figure 7.11: Translated by Index source

The solution is to adhere to a consistent Best Practice of positioning child objects accordingto the center (or some other known datum point) of the parent object. This can easily be ac-complished through the use of the translate operator. The translate operator works within thecontext of a GDL object, and allows a 3D point to be translated in up to three directions, selectedfrom: :up, :down, :left, :right, :front, :rear. Figures 7.11 and 7.12 show the equivalent ofour positioned-by-index example, but with all the positioning done relative to the parent’s center.

7.2.4 Display Controls

It is possible to specify particular default display characteristics4 for objects in GDL, such as:

• color

• line-thickness (for line-based output formats like PDF)

• transparency (for shaded graphics outputs like X3D)

The most common display-control is probably :color. Color in GDL can be specified in one ofthree formats:

1. By name. The names can be seen at the URL http://localhost:9000/color-map as seenin Figure 7.13

4In addition to display-controls attached to a geometric entity itself, GDL also supports the concept of lenses,which capture the program code used to output a particular class of entities (e.g. box in a particular output format(e.g. pdf. Lenses will be covered in more detail in Chapter ??.

Page 56: Genworks GDL: A User's Manual - Genworks International

50 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.12: Translated by Index

Page 57: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 51

Figure 7.13: Color Map (assembled by Andrew Wolven from standard X Window colors)

Page 58: Genworks GDL: A User's Manual - Genworks International

52 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

2. By hexadecimal Red-Green-Blue values, in the form of a string beginning with the “#”character. Each two-digit hex number represents a component of Red, Green, or Blue (tomake this easy to remember, use the mnemonic “Roy G. Biv” from the rainbow colors). Forexample, #000000 represents pure Black, and #FFFFFF represents pure White. #FF0000 wouldbe pure Red, #00FF00 would be pure Green, and #FF00FF would be Purple (a mix of Redand Blue). Note that this is also a standard for HTML and the World Wide Web.

3. By a list of three decimal numbers between 0.0 and 1.0, again representing values for Red,Green, and Blue. For example, (1.0 1.0 1.0) would be pure White, and (0.0 0.0 0.0)

would be pure Black.

The display-controls is an optional input-slot for any geometric entity in GDL, and is ex-pected to be a Property List containing alternating keywords and values. Common keywords forthe display-controls, corresponding to the display characteristics listed above, are:

• :color

• :line-thickness

• :transparency

Figures 7.15 and 7.14 demonstrate the use of the :color keyword in the display-controls

for our positioned boxes example.

7.2.5 Orientation and the Alignment function

Orientations in GDL are specified using a 3x3 orientation matrix. The simplest way to compute anorientation matrix is to use the use the alignment function. The alignment function accepts upto three direction keywords, and corresponding vectors to which these directions should be aligned.For example, to obtain an orientation matrix specifying that the Rear of a reference box should bealigned with the vector #(1.0 0.0 0.0), you could call

(alignment :rear (make-vector 1 0 0))

Generally, you will want the orientation of a child object to be specified in a relative manner tothat of the current (parent) object. The concept here is similar to that for positioning with respectto (the center). For relative orientation, you can utilize the various face-normal-vectors ofthe parent object. For example, by default, cylinders are aligned with their flat ends along thelongitudinal (Y) axis. Figures 7.16 and 7.17 show the red cylinder which is turned to be vertical(aligned to the Z axis), by aligning its :rear face with (the (face-normal-vector :top)) of theparent base-object.

7.2.6 Rotating vectors with the rotate-vector-d function

In order to specify a vector which is not aligned exactly with one of the major axes, you can usethe rotate-vector-d function to yield a new vector which is the result of “rotating” one vectorabout another vector. Figures 7.18 and 7.19 show a stack of boxes, where the rear face of each boxis rotated 2 degrees with respect to the box under it.

Page 59: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 53

(in-package :gdl-user)

(define-object display-color (base-object)

:input-slots ((number-of-boxes 5))

:computed-slots ((length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+))

(color-list (list :red :orange :yellow :blue :indigo :violet)))

:objects ((boxes :type ’box

:sequence (:size (the number-of-boxes))

:display-controls (list :color (or (nth (the-child index)

(the color-list)) :black)

:line-thickness 2)

:center (translate (the center)

:right (* (the width) (the-child index))))))

Figure 7.14: Color controlled by display-controls source

Page 60: Genworks GDL: A User's Manual - Genworks International

54 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.15: Color controlled by display-controls

(in-package :gdl-user)

(define-object vertical-cylinder (base-object)

:objects

((horizontal-cylinder :type ’cylinder

:display-controls (list :color :green)

:length 10 :radius 3)

(vertical-cylinder :type ’cylinder

:length 10 :radius 3

:display-controls (list :color :red)

:orientation (alignment :rear

(the (face-normal-vector :top))))))

Figure 7.16: Cylinder aligned vertically source

Page 61: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 55

Figure 7.17: Cylinder aligned vertically

Page 62: Genworks GDL: A User's Manual - Genworks International

56 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

(in-package :gdl-user)

(define-object tower (base-object)

:input-slots

((height 42)

(block-height 1)

(width +phi+)

(length (* (the width) +phi+)))

:computed-slots

((number-of-blocks (floor (the height)

(the block-height))))

:objects

((blocks :type ’box

:sequence (:size (the number-of-blocks))

:length (the length)

:height (the block-height)

:width (the width)

:center (translate (the center) :up

(* (the-child height)

(the-child index)))

:orientation (alignment :rear (rotate-vector-d

(the (face-normal-vector :rear))

(twice (the-child index))

(the (face-normal-vector :top)))))))

Figure 7.18: Twisty Tower source

Page 63: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 57

Figure 7.19: Twisty Tower

Page 64: Genworks GDL: A User's Manual - Genworks International

58 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

(in-package :gdl-user)

(define-object tower-assembly (base-object)

:input-slots

((base-height 10)

(height-deviation 5)

(number-of-towers 5))

:objects

((towers :type ’tower

:sequence (:size (the number-of-towers))

:height (+ (* (the-child index) (the height-deviation))

(the base-height))

:center (translate (the center) :right (* (twice

(twice (the-child width)))

(the-child index))))))

Figure 7.20: Tower Assembly source

7.2.7 Assemblies

Objects which you define with define-object can be used no differently from the built-in primi-tives. This underscores why it is important for the positioning and orientation passed into a childobject be relative to that present in the parent. Figures 7.21 and 7.20 show how several towerscan be positioned side-by-side, while maintaining consistent internal positioning and orientation.Figure ?? shows how the child towers form an assembly hierarchy of objects.

7.2.8 Mechanisms

GDL supports mechanisms without need for any special features. By defining position and orien-tation of some objects to be dependent on others, you can set up a mechanism. Figure 7.23 showsa standard four-bar link mechanism which is defined in the code in the file 4-bar-assembly.gdl (thisis in the examples directory5 — due to its length, the source is not printed in the manual.

7.2.9 Other Geometric Primitives

This chapter has focused primarily on the box primitive, because every type of geometric primitiveis based upon a reference box. Other primitives have their own sets of input-slots, and their ownways of being rendered in the various output formats. Basic 2D primitives include:

• circle described on page 121

5http://github.com/genworks/gendl/tree/master/documentation/tutorial/examples/

Page 65: Genworks GDL: A User's Manual - Genworks International

7.2. BUILDING A GEOMETRIC GDL MODEL FROM LLPS 59

Figure 7.21: Tower Assembly

Figure 7.22: Tower Assembly as displayed in Tasty

Page 66: Genworks GDL: A User's Manual - Genworks International

60 CHAPTER 7. WORKING WITH GEOMETRY IN GDL

Figure 7.23: Four-bar Link Mechanism

• line described on page 143

• arc described on page 105

• ellipse described on page 127

• bezier-curve6 described on page 115

Basic 3D primitives include:

• sphere described on page 156

• cylinder described on page 125

• cone described on page 123

• global-polyline described on page 137

• global-polygon-projection described on page 135

• global-filleted-polyline described on page 137

• torus described on page 160

• route-pipe described on page 153

6The simple cubic bezier curve is supported in the basic GDL and open-source Gendl. More sophisticated NURBS-based curves and surfaces are supported in the commercial GDL product when accompanied with the SMLib geometrykernel. These are covered in chapter ??

Page 67: Genworks GDL: A User's Manual - Genworks International

Chapter 8

Custom User Interfaces in GDL

Another strength of GDL is the ability to create custom web-based user interfaces. GDL containsa built-in web server and supports the creation of generative web-based user interfaces1. Usingthe same define-object syntax which you have already encountered, you can define web pages,sections of web pages, and form control elements such as type-in fields, checkboxes, and choice lists[using this capability does require a basic working knowledge of the HTML language].2.

Any web extensions such as custom JavaScript and JavaScript libraries can also be used, aswith any standard web application.

With the primitive objects and functions in its :gwl package, GDL supports both the traditional“Web 1.0” interfaces (with fillout forms, page submittal, and complete page refresh) as well as so-called “Web 2.0” interaction with AJAX.

8.1 Package and Environment for Web Development

Similarly to gdl:define-package, you can use gwl:define-package in order to create a workingpackage which has access to the symbols you will need for building a web application (in additionto the other GDL symbols).

The :gwl-user package is pre-defined and may be used for practice work. For real projects,you should define your own package using gwl:define-package.

The acronym “GWL” stands for Generative Web Language, which is not a separate languagefrom GDL itself, but rather is a set of primitive objects and functions available within GDL forbuilding web applications. The YADD reference documentation for package “Generative WebLanguage” provides detailed specifications for all the primitive objects and functions.

8.2 Traditional Web Pages and Applications

To make a GDL object presentable as a web page, the following two steps are needed:

1. Mix base-html-sheet into the object definition.

1GDL does not contain support for native desktop GUI applications. Although the host Common Lisp environment(e.g. Allegro CL or LispWorks) may contain a GUI builder and Integrated Development Environment, and you arefree to use these, GDL does not provide specific support for them.

2We will not cover HTML in this manual, but plentiful resources are available online and in print.

61

Page 68: Genworks GDL: A User's Manual - Genworks International

62 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

(in-package :gwl-user)

(define-object president (base-html-sheet)

:input-slots

((name "Carter") (term 1976) (table-border 1))

:functions

((write-html-sheet

() (with-cl-who (:indent t)

(:html (:head (:title (fmt "Info on President: ~a"

(the name))))

(:body ((:table :border (the table-border))

(:tr (:th "Name") (:th "Term"))

(:tr (:td (str (the name)))

(:td (str (the term)))))))))))

;;

;; Access the above example with

;; http://localhost:9000/make?object=gwl-user::president

;;

Figure 8.1: Simple Static Page Example

2. define a GDL function called main-sheet within the object definition.

The main-sheet function should return valid HTML for the page. The easiest way to produceHTML is with the use of an HTML generating library, such as CL-WHO3 or HTMLGen4, both ofwhich are built into GDL.

For our examples we will use cl-who, which is currently the standard default HTML generatinglibrary used internally by GDL. Here we will make note of the major features of cl-who whileintroducing the examples. For complete documentation on cl-who, please visit the page at EdiWeitz’ website linked above and listed in the footnote below.

8.2.1 A Simple Static Page Example

In Figure 8.1, GWL convenience macro with-cl-who is used; this sets up a standard defaultenvironment for outputting HTML within a GWL application.

The code in Figure 8.1 produces HTML output as shown in Figure 8.2 which looks similar toFigure 8.3 in a web browser.

Several important concepts are lumped into this example. Note the following:

• Our convenience macro with-cl-who is used to wrap the native with-html-output macrowhich comes with the cl-who library.

3http://weitz.de/cl-who4http://www.franz.com/support/documentation/current/doc/aserve/htmlgen.html

Page 69: Genworks GDL: A User's Manual - Genworks International

8.2. TRADITIONAL WEB PAGES AND APPLICATIONS 63

<html>

<head>

<title>Info on President: Carter

</title>

</head>

<body>

<table border="1">

<tr> <th>Name</th>

<th>Term</th>

</tr>

<tr> <td>Carter</td>

<td>1976</td>

</tr>

</table>

</body></html>

Figure 8.2: Simple Static Page Example

Figure 8.3: Simple Static Page Example

Page 70: Genworks GDL: A User's Manual - Genworks International

64 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

• We use the keyword argument :indent t in order to pretty-print the generated HTML. Thisdoes not affect the browser display but can make the generated HTML easier to read anddebug. This option should be left as nil (the default) for production deployments.

• The fmt symbol has special meaning within the cl-who environment and works the sameas a Common Lisp (format nil ...) in order to evaluate a format string together withmatching arguments, and produce a string at runtime.

• The str symbol has special meaning within the cl-who environment and works by evaluatingan expression at runtime to return a string or other printable object, which is then includedat that point in the HTML output.

• Expressions within the body of an HTML tag have to be evaluated, usually by use of the fmt

or str in cl-who. There are three examples of this in the above sample: one fmt and twostr.

• Expressions within a tag attribute are always evaluated automatically, and so do not requirea str or other special symbol to force evaluation at runtime. Tag attributes in HTML (orXML) are represented as a plist spliced in after a tag name, wrapped in extra parenthesesaround the tag name. In the sample above, the :border (the table-border) is an exampleof a tag attribute on the :table tag. Notice that the expression (the table-border) doesnot need str in order to be evaluated - it gets evaluated automatically.

• In cl-who, if a tag attribute evaluates to nil, then that tag attribute will be left out of theoutput completely. For example if (the table-border) evaluates to nil, then the :table

tag will be outputted without any attributes at all. This is a convenient way to conditionalizetag attributes.

• The URL http://localhost:9000/make?object=gwl-user::president is published auto-matically based on the package and name of the object definition. When you visit this URL,the response is redirected to a unique URL identified by a session ID. This ensures thateach user to your application site will see their own specific instance of the page object. Thesession ID is constructed from a combination of the current date and time, along with apseudo-random number.

8.2.2 A Simple Dynamic Page which Mixes HTML and Common Lisp/GDL

Within the cl-who environment it is possible to include any standard Common Lisp structures suchas let, dolist , dotimes, etc, which accept a body of code. The requirement is that any internalcode body must be wrapped in a list beginning with the special symbol htm, which has meaning tocl-who.

The example in Figure 8.4 uses this technique to output an HTML table row for each “row” ofdata in a list of lists. The output looks similar to Figure 8.5 in a web browser.

Note the following from this example:

• title is a let variable, so we use (str title) to evaluate it as a string. We do not use (str(the title)) because title is a local variable and not a message (i.e. slot) in the object.

• Inside the dolist, we “drop back into” HTML mode using the htm operator.

Page 71: Genworks GDL: A User's Manual - Genworks International

8.2. TRADITIONAL WEB PAGES AND APPLICATIONS 65

(in-package :gwl-user)

(define-object presidents (base-html-sheet)

:input-slots

((presidents (list (list :name "Ford"

:term 1974)

(list :name "Carter"

:term 1976)

(list :name "Clinton"

:term 1992)

(list :name "Bush"

:term 2000)

(list :name "Obama"

:term 2008)))

(table-border 1))

:functions

((write-html-sheet

()

(with-cl-who (:indent t)

(let ((title (format nil "Info on ~a Presidents:"

(length (the presidents)))))

(htm

(:html

(:head (:title (str title)))

(:body

(:p (:c (:h3 (str title))))

((:table :border (the table-border))

(:tr (:th "Name") (:th "Term"))

(dolist (president (the presidents))

(htm

(:tr (:td (str (getf president :name)))

(:td (str (getf president :term)))))))))))))))

;;

;; Access the above example with

;; http://localhost:9000/make?object=gwl-user::presidents

;;

Figure 8.4: Mixing Static HTML and Dynamic Content

Page 72: Genworks GDL: A User's Manual - Genworks International

66 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

Figure 8.5: Mixing Static HTML and Dynamic Content

8.2.3 Linking to Multiple Pages

The base-html-sheet mixin provides a self-link message for the purpose of generating a hyperlinkto that page. Typically you will have a “parent” page object which links to its “child” pages, butGDL pages can link to other pages anywhere in the GDL tree5.

In Figures 8.6 and 8.7, we provide links from a parent page into a child page with detailedinformation on each president. The output looks similar to Figure 8.8 in a web browser.

Note the following from this example:

• The write-self-link message is a function which can take a keyword argument of :display-string.This string is used for the actual hyperlink text.

• There is a write-back-link message which similarly can take a keyword argument of :display-string.This generates a link back to (the return-object) which, by default in base-html-sheet, is(the parent).

8.2.4 Form Controls and Fillout-Forms

Form Controls

GDL provides a set of primitives useful for generating the standard HTML form-controls6 such astext, checkbox, radio, submit, menu, etc. These should be instantiated as child objects in the page,then included in the HTML for the page using str within an HTML form tag (see next section).

The form-controls provided by GDL are documented in YADD accessible with

5In order for dependency-tracking to work properly, the pages must all belong to the same tree, i.e. they mustshare a common root object.

6http://www.w3.org/TR/html401/interact/forms.html

Page 73: Genworks GDL: A User's Manual - Genworks International

8.2. TRADITIONAL WEB PAGES AND APPLICATIONS 67

(in-package :gwl-user)

(define-object presidents-with-pages (base-html-sheet)

:input-slots

((presidents (list (list :name "Ford" :term 1974)

(list :name "Carter" :term 1976)

(list :name "Clinton" :term 1992)

(list :name "Bush" :term 2000)

(list :name "Obama" :term 2008)))

(table-border 1))

:objects

((president-pages :type ’president-page

:sequence (:size (length (the presidents)))

:name (getf (nth (the-child index) (the presidents))

:name)

:term (getf (nth (the-child index) (the presidents))

:term)))

:functions

((write-html-sheet

()

(with-cl-who (:indent t)

(let ((title (format nil "Info on ~a Presidents:"

(length (the presidents)))))

(htm

(:html

(:head (:title (str title)))

(:body

(:p (:c (:h3 (str title))))

(:ol

(dolist (page (list-elements (the president-pages)))

(htm

(:li

(the-object

page

(write-self-link :display-string

(the-object page name)))))))))))))))

;;

;; Access the above example with

;; http://localhost:9000/make?object=gwl-user::presidents-with-pages

;;

Figure 8.6: Linking to Multiple Pages

Page 74: Genworks GDL: A User's Manual - Genworks International

68 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

(in-package :gwl-user)

(define-object president-page (base-html-sheet)

:input-slots

(name term)

:functions

((write-html-sheet

()

(with-cl-who ()

(let ((title (format nil "Term for President ~a:"

(the name))))

(htm

(:html

(:head (:title (str title)))

(:body

(the (write-back-link :display-string "&lt;Back"))

(:p (:c (:h3 (str title))))

(:p (str (the term)))))))))))

Figure 8.7: Linking to Multiple Pages

Figure 8.8: Linking to Multiple Pages

Page 75: Genworks GDL: A User's Manual - Genworks International

8.3. PARTIAL PAGE UPDATES WITH GDLAJAX 69

http://localhost:9000/yadd

and in Chapter ?? of this Manual. Examples of available form-controls are:

• text-form-control

• checkbox-form-control

• menu-form-control

• radio-form-control

• text-form-control

• button-form-control

These form-controls are customizable by mixing them into your own specific form-controls(although this often is not necessary). New form-controls such as for numbers, dates, etc will soonbe added to correspond to latest HTML standards.

Fillout Forms

A traditional web application must enclose form controls inside a form tag and specify an action

(a web URL) to receive and respond to the form submission. The response will cause the entirepage to refresh with a new page. In GDL, such a form can be generated by wrapping the layout ofthe form controls within the with-html-form macro.

Figure 8.9 is an example which allows the user to enter a year, and the application will respondwith the revenue amount for that year. Additional form controls are also provided to adjust thetable border and cell padding.

This example, when instantiated in a web browser, might look as shown in Figure 8.10.

8.3 Partial Page Updates with gdlAjax

AJAX stands for Asynchronous JavaScript and XML 7, and allows for more interactive web appli-cations which respond to user events by updating only part of the web page. The “Asynchronous”in Ajax refers to a web page’s ability to continue interacting while one part of the page is beingupdated by a server response. Requests need not be Asynchronous, they can also be Synchronous(“SJAX”), which would cause the web browser to block execution of any other tasks while therequest is being carried out. The “XML” refers to the format of the data that is typically returnedfrom an AJAX request.

GDL contains a simple framework referred to as gdlAjax which supports a uniquely convenientand generative approach to AJAX (and SJAX). With gdlAjax, you use standard GDL objectdefinitions and child objects in order to model the web page and the sections of the page, and thedependency tracking engine which is built into GDL automatically keeps track of which sections ofthe page need to be updated after a request.

7http://en.wikipedia.org/wiki/Ajax (programming)

Page 76: Genworks GDL: A User's Manual - Genworks International

70 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

(in-package :gwl-user)

(define-object revenue-lookup-old-school (base-ajax-sheet)

:input-slots

((revenue-data ’(2003 25000

2004 34000

2005 21000

2006 37000

2007 48000

2008 54000

2009 78000)))

:functions

((write-html-sheet

()

(with-cl-who ()

(when *developing?* (str (the development-links)))

(with-html-form (:cl-who? t)

(:p (str (the table-border html-string)))

(:p (str (the cell-padding html-string)))

(:p (str (the selected-year html-string)))

(:p ((:input :type :submit :value " OK "))))

(:p ((:table :border (the table-border value)

:cellpadding (the cell-padding value))

(:tr (:th (fmt "Revenue for Year ~a:"

(the selected-year value)))

(:td (str (getf (the revenue-data)

(the selected-year value))))))))))

:objects

((table-border :type ’menu-form-control

:size 1 :choice-list ’(0 1)

:default 0)

(cell-padding :type ’menu-form-control

:size 1 :choice-list ’(0 3 6 9 12)

:default 0)

(selected-year :type ’menu-form-control

:size 1 :choice-list (plist-keys (the revenue-data))

:default (first (the-child choice-list)))))

(publish-gwl-app "/revenue-lookup-old-school"

"gwl-user::revenue-lookup-old-school")

;;

;; Access the above example with

;; http://localhost:9000/make?object=gwl-user::revenue-lookup-old-school

;;

Figure 8.9: Form Controls and Fillout Forms

Page 77: Genworks GDL: A User's Manual - Genworks International

8.3. PARTIAL PAGE UPDATES WITH GDLAJAX 71

Figure 8.10: Form Controls and Fillout Forms

Moreover, the state of the internal GDL model which represents the page and the page sectionsis kept identical to the displayed state of the page. This means that if the user hits the “Refresh”button in the browser, the state of the page will remain unchanged. This ability is not available insome other Ajax frameworks.

8.3.1 Steps to Create a gdlAjax Application

Initially, it is important to appreciate that the fundamentals from the previous section on StandardWeb Applications still apply for gdlAjax applications — that is, HTML generation, page linking,etc. These techniques will all still work in a gdlAjax application.

To produce a gdlAjax application entails three main differences from a standard web application:

1. You mix in base-ajax-sheet instead of base-html-sheet. base-ajax-sheet mixes inbase-html-sheet, so it will still provide all the functionality of that mixin. In fact, youcan use base-ajax-sheet in standard web applications and you won’t notice any differenceif you do everything else the same.

2. Instead of a write-html-sheet message, you specify a main-sheet-body message. Themain-sheet-body can be a computed-slot or GDL function, and unlike the write-html-sheetmessage, it should simply return a string, not send output to a stream. Also, it only fills inthe body of the page — everything between the ¡body¿ and ¡/body¿ tags. The head tag ofthe page is filled in automatically and can be customized in various ways.

3. Any sections of the page which you want to have the capacity to change themselves in responseto an Ajax call must be made into separate page sections, or “sheet sections,” and the HTMLfor their main-div included in the main page’s main-sheet-body by use of cl-who’s str

directive.

Page 78: Genworks GDL: A User's Manual - Genworks International

72 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

Note the following from the example in Figure 8.11:

• We mix in base-ajax-sheet and specify a main-sheet-body slot, which uses with-cl-who-stringto compute a string of HTML. This approach is also easier to debug, since the main-sheet-bodystring can be evaluated in the tasty inspector or at the command-line.

• We use str to include the string for the main page section (called main-section in thisexample) into the main-sheet-body.

• In the main-section, we also use str to include the html-string for each of three form-controls. We have provided a form control for the table border, the table padding, and therevenue year to look up.

• The only page section in this example is (the main-section). This is defined as a childobject, and has its inner-html computed in the parent and passed in as an input. Thesheet-section will automatically compute a main-div message based on the inner-html

that we are passing in. The main-div is simply the inner-html, wrapped with an HTMLDIV (i.e. “division”) tag which contains a unique identifier for this section, derived from theroot-path to the GDL object in the tree which represents the sheet section.

• We introduce the CL function gwl:publish-gwl-app, which makes available a simplifiedURL for visiting an instance of this object in the web browser. In this case, we can accessthe instance using http://localhost:9000/revenue-lookup

Notice also the use of :ajax-submit-on-change? ... in each of the form-controls. Thisdirects the gdlAjax system to “scrape” the values of these form controls and “bash” them into thevalue slot of the corresponding object on the server, whenever they are changed in the browser.No “Submit” button press is necessary.

It is also possible programmatically to send form-control values, and/or call a GDL Function,on the server, by using the gdl-ajax-call GDL function. This function will emit the necessaryJavaScript code to use as an event handler, e.g. for an “onclick” event. For example, you couldhave the following snippet somewhere in your page:

((:span :onclick (the (gdl-ajax-call :function-key :restore-defaults!))) "Press Me" )

This will produce a piece of text “Press Me,” which, when pressed, will have the effect of call-ing a function named restore-defaults! in the page’s object on the server. If the functionrestore-defaults! is not defined, an error will result. The gdl-ajax-call GDL function canalso send arbitrary form-control values to the server by using the :form-controls keyword ar-gument, and listing the relevant form-control objects. The gdl-ajax-call GDL function is fullydocumented in YADD and the reference appendix.

If for some reason you want to do more than one gdl-ajax-call sequentially, then it is best touse gdl-sjax-call instead. This variant will cause the browser to wait until each call completes,before making the next call. To achieve this, you would want to append the strings together, e.g:

((:span :onclick (string-append (the (gdl-sjax-call ...))

(the (gdl-sjax-call ...))

(the (gdl-sjax-call ...))) ... ))

Page 79: Genworks GDL: A User's Manual - Genworks International

8.3. PARTIAL PAGE UPDATES WITH GDLAJAX 73

(in-package :gwl-user)

(define-object revenue-lookup (base-ajax-sheet)

:input-slots

((revenue-data ’(2003 25000

2004 34000

2005 21000

2006 37000

2007 48000

2008 54000

2009 78000)))

:computed-slots

((main-sheet-body

(with-cl-who-string ()

(str (the main-section main-div)))))

:objects

((table-border :type ’menu-form-control

:size 1

:choice-list ’(0 1)

:default 0

:ajax-submit-on-change? t)

(cell-padding :type ’menu-form-control

:size 1

:choice-list ’(0 3 6 9 12)

:default 0

:ajax-submit-on-change? t)

(selected-year :type ’menu-form-control

:size 1

:choice-list (plist-keys (the revenue-data))

:default (first (the-child choice-list))

:ajax-submit-on-change? t)

(main-section

:type ’sheet-section

:inner-html (with-cl-who-string ()

(:p (str (the development-links)))

(:p (str (the table-border html-string)))

(:p (str (the cell-padding html-string)))

(:p (str (the selected-year html-string)))

(:p ((:table :border (the table-border value)

:cellpadding (the cell-padding value))

(:tr (:th (fmt "Revenue for Year ~a:"

(the selected-year value)))

(:td (str (getf (the revenue-data)

(the selected-year value)))))))))))

(publish-gwl-app "/revenue-lookup"

"gwl-user::revenue-lookup")

Figure 8.11: Partial Page Updates with GdlAjax

Page 80: Genworks GDL: A User's Manual - Genworks International

74 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

With that said, it is rarely necessary to do these calls sequentially like this, because you can use:form-controls and :function-key simultaneously. As long as your logic works correctly when theform-controls are set before the function is called, then you can group the functions together intoa “wrapper-function,” and do the entire processing with a single Ajax (or Sjax) call. This wouldbe be the recommended approach whenever possible.

8.3.2 Including Graphics

The fundamental mixin or child type to make a graphics viewport is base-ajax-graphics-sheet.This object definition takes several optional input-slots, but the most essential are the :display-list-objectsand the :display-list-object-roots. As indicated by their names, you specify a list of nodesto include in the graphics output with the :display-list-objects, and a list of nodes whoseleaves you want to display in the graphics output with the :display-list-object-roots. Viewcontrols, rendering format, action to take when clicking on objects, etc, can be controlled withother optional input-slots.

The example in Figure 8.12 contains a simple box with two graphics viewports and ability tomodify the length, height, and and width of the box:

This will produce a web browser output similar to what is shown in Figure 8.13.Note the following from this example:

• The (:use-raphael? t) enables raphael for SVG or VML output.

• The :raphael image-format generates SVG or VML, depending on the browser.

• We conditionally include development-links for full Update and SetSelf! actions.

• We include two viewports in the main-sheet-body, elements from a sequence of size 2.

• In the inputs-section, we use the html-string message from each form-control to display thedefault decoration (prompt, etc).

Page 81: Genworks GDL: A User's Manual - Genworks International

8.3. PARTIAL PAGE UPDATES WITH GDLAJAX 75

(in-package :gwl-user)

(define-object box-with-inputs (base-ajax-sheet)

:computed-slots

((use-raphael? t)

(use-x3dom? t)

(main-sheet-body

(with-cl-who-string ()

(:p (when *developing?* (str (the development-links))))

(:p (str (the inputs-section main-div)))

(:table

(:tr

(dolist (viewport (list-elements (the viewport-sections)))

(htm (:td (:td (str (the-object viewport main-div)))))))))))

:objects

((box :type ’box

:height (the inputs-section box-height value)

:width (the inputs-section box-width value)

:length (the inputs-section box-length value))

(inputs-section :type ’inputs-section)

(viewport-sections

:type ’base-ajax-graphics-sheet

:sequence (:size 2)

:view-direction-default (ecase (the-child index)

(0 :top) (1 :trimetric))

:image-format-default :raphael

:display-list-objects (list (the box))

:length 250 :width 250)))

(define-object inputs-section (sheet-section)

:computed-slots

((inner-html (with-cl-who-string ()

(:p (str (the box-length html-string)))

(:p (str (the box-width html-string)))

(:p (str (the box-height html-string))))))

:objects

((box-length :type ’text-form-control

:default 25

:ajax-submit-on-change? t)

(box-width :type ’text-form-control

:default 35

:ajax-submit-on-change? t)

(box-height :type ’text-form-control

:default 45

:ajax-submit-on-change? t)))

(publish-gwl-app "/box-with-inputs"

"gwl-user::box-with-inputs")

;;

;; Access the above example with

;; http://localhost:9000/make?object=gwl-user::box-with-inputs

;;

Figure 8.12: Including Graphics in a Web Page

Page 82: Genworks GDL: A User's Manual - Genworks International

76 CHAPTER 8. CUSTOM USER INTERFACES IN GDL

Figure 8.13: Including Graphics

Page 83: Genworks GDL: A User's Manual - Genworks International

Chapter 9

More Common Lisp for GDL

77

Page 84: Genworks GDL: A User's Manual - Genworks International

78 CHAPTER 9. MORE COMMON LISP FOR GDL

Page 85: Genworks GDL: A User's Manual - Genworks International

Chapter 10

Advanced GDL

79

Page 86: Genworks GDL: A User's Manual - Genworks International

80 CHAPTER 10. ADVANCED GDL

Page 87: Genworks GDL: A User's Manual - Genworks International

Upgrade Notes

GDL 1580 marked the end of a major branch of GDL development, and 1581 was an upgraded newversion, which in turn has now been supplanted by 1582.

This addendum lists the typical modifications you will want to consider for upgrading fromGDL 1580 to GDL 1582, or later versions.

• (make-gdl-app ..) is now available for 1582. We have made available an Enterprise Edition of1582 which includes the make-gdl-app function, which creates Runtime applications withoutthe compiler or GDL development facilities. If you are an Enterprise licensee, and are ready torelease Runtime applications on 1582, and you have not received information on the EnterpriseEdition, please contact [email protected]

• (register-asdf-systems) and the "3rdpty/" directory are no longer needed or available. In-stead, we depend on the Quicklisp system. Details of Quicklisp are available at http://www.quicklisp.org.See Section 3.3.4 for information about how to use Quicklisp with GDL.

• There is a system-wide gdlinit.cl in the application directory, and depending on the partic-ular release you have, this may have some default information which ships with GDL. There isa personal gdlinit.cl in home directory, which you should modify if you want to customizeanything.

• Slime debugging is different from the ELI emacs debugger. The main thing to know is topress “a” or “q” to pop out of the current error. Full documentation for the Slime debugmode is available with the Slime documentation.

• color-themes – GDL now ships with the Emacs color-theme package. You can select a differentcolor theme with M-x color-theme-select. Press [Enter] or middle-mouse on a color themeto apply it.

• GDL files can now end with .lisp or .gdl. The new .gdl extension will work for emacsLisp mode and will work with cl-lite, ASDF, and Quicklisp for including source files in ap-plication systems. We recommend migrating to the new .gdl extension for files contain-ing define-object, define-format, and define-lens forms, and any other future topleveldefining forms introduced by GDL, in order to distinguish from files containing raw CommonLisp code.

• in gdlAjax, HTML for a sheet-section is given in the slot called inner-html instead ofmain-view. This name change was made to clarify what exactly is expected in this slot– it is the innerHTML of the page division represented by the current sheet-section. If you

81

Page 88: Genworks GDL: A User's Manual - Genworks International

82 CHAPTER 10. ADVANCED GDL

want to make your code back-compatible with GDL 1580, you can use the following form inplace of old occurences of main-view:

... #+allegro-v8.1 main-view #-allegro-v8.1 inner-html ...

• (update-gdl ..) is not yet available for 1582. Instead of updating incrementally with patches,the intention starting with GDL 1582 is for full GDL releases to be made available approxi-mately monthly. Less frequent Long Term Maintenance (“LTS”) releases will also be madeavailable along with a new simpler maintenance patch system.

Page 89: Genworks GDL: A User's Manual - Genworks International

Chapter 11

Reference for GDL Objects andOperators

11.1 cl-lite (Compile-and-Load Lite Utility)

11.1.1 Object Definitions

• codebase-directory-node

Mixins: directory-node

Description Models a filesystem directory for use by the cl-lite program.

Input slots (optional):

Bin-subdir-names List of strings

Identifies the names of directories considered to hold binaries. Default is (list ”bin””patch”)

Create-fasl? Boolean

Determines whether to write a concatenated fasl for the build. Defaults to nil. NOTE:this is not currently supported in cl-lite.

Fasl-output-name String

Names the built concatenated fasl when (the create-fasl?) is non-nil. Defaults to(the local-name)

Fasl-output-path String or pathname object

Designates the pathname for the filesystem directory in which the built concatenatedfasls are written. Defaults to (glisp:temporary-folder)

Fasl-output-type String

Names the fasl extension used by the compiler. Defaults to the local fasl output type.

Load-always? Boolean

Determines whether to load the individual compiled fasls even if the source has notchanged. Defaults to nil (i.e. we assume we are loading into a clean system and need allthe initial definitions.).

83

Page 90: Genworks GDL: A User's Manual - Genworks International

84 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Source-files-to-ignore List of strings

Lists directory names which should be ignored as having compilable source code for thebuild.

Special-subdir-names List of strings

Identifies the names of directories which are part of a vc-system control files and thereforeshould be treated as special subdirectories. Default is (list ”CVS”)

Type-mapping Plist of keywords and lists of strings

Maps directory names to their default type classifications.

Computed slots:

Strings-for-display String or List of Strings

Determines how the name of objects of this type will be printed in most places. Thisdefaults to the name-for-display (generally the part’s name as specified in its parent),followed by an index number if the part is an element of a sequence.

11.1.2 Function and Macro Definitions

• cl-patch

(type nil intro Traverses pathname in a manner identical to cl-lite, but only those files forwhich the source is newer than the corresponding fasl binary file (or for which the correspond-ing fasl binary file does not exist) will be loaded. Use this for incremental updates where theunmodified source files do not depend on the modified source files. )

11.2 com.genworks.dom

11.3 com.genworks.dom-html

11.4 com.genworks.dom-latex

11.5 com.genworks.dom-writers

11.6 com.yoyodyne.booster-rocket

11.7 enterprise

11.8 gendl (Base Core Kernel Engine) Nicknames: Gdl, Gen-works, Base

11.8.1 Object Definitions

• base-rule-object

Mixins: vanilla-mixin

Page 91: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE85

Description Encapsulates a basic computation, usually to be displayed to the user. Typi-cally this would be used as a mixin into a more sophisticated rule-object, but the typecan be used to detect objects which should be processed as ”rules.”

Input slots (optional):

Rule-description String

Short description of the rule (generally one line). Defaults to NIL.

Rule-description-help String

Verbose description of the purpose of the rule.

Rule-result String

The basic return-value, or result, of evaluating the rule.

Rule-result-help String

Verbose description of how the rule result is computed.

Rule-title String

Title to be used with the rule object. Defaults to NIL.

Strings-for-display String

Determines the rule’s default name in various internal GDL contexts. Defaults to therule-title, or ”Unnamed Rule” if rule-title is NIL.

Suppress-display? Boolean

Determines whether the rule is displayed by default in reports etc.

Violated? Boolean

Indicates whether this rule violates a standard condition.

• matrix-sequence

Mixins: standard-sequence, vanilla-mixin

Description A matrix sequence quantification is generated as a result of specifying :sequence

(:matrix direction-keyword number direction-keyword number)) in an :objects

specification. The direction-keywords can be one of :lateral, :longitudinal, and:vertical. The items will be arranged spread out evenly in the directions specified.Centers can also be provided explicitly based on the indices. The indices to a matrixsequence consist of a list of numbers rather than a single number as with a normalsequence.

Computed slots:

First GDL Object

Returns the first element of the aggregate.

Last GDL Object

Returns the last element of the aggregate.

Page 92: Genworks GDL: A User's Manual - Genworks International

86 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• null-object

Mixins: vanilla-mixin

Description A part with no geometric representation and no children. Use this in a con-ditional :type expression if you want to turn off a branch of the tree conditionally.

• quantification

Mixins: vanilla-mixin

Description A quantification is an aggregate created as a result of specifying :sequence

(:size ...)) or :sequence (:indices ...)) in an :objects specification. Usually,the elements of a quantified set are referenced by using extra parentheses around themessage in the reference chain and using the index number. But the aggregate itselfalso supports certain messages, documented here. One message, number-of-elements,is not listed in the normal messages section because it is internal. It can be used, andreturns an integer representing the cardinality of the aggregate.

Computed slots:

First GDL Object

Returns the first element of the aggregate.

Last GDL Object

Returns the last element of the aggregate.

• radial-sequence

Mixins: standard-sequence, vanilla-mixin

Description A radial sequence quantification is generated as a result of specifying :sequence

(:radial [number-expression])) in an :objects specification.

• standard-query-row

Mixins: vanilla-mixin

Description Represents a row of data.

Input slots (optional):

Type Symbol

The GDL Type of this object.

• standard-sequence

Mixins: quantification

Page 93: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE87

Description A standard sequence quantification is generated as a result of specifying :sequence

(:size [number-expression])) in an :objects specification. Unlike a variable-sequencequantification (specified with :sequence (:indices ...))), elements cannot be surgi-cally inserted or deleted from a standard sequence. If a value upon which the [number-expression] depends becomes modified, each member of the sequence will be reinstanti-ated as it is demanded.

Computed slots:

First GDL Object

Returns the first element of the aggregate.

Last GDL Object

Returns the last element of the aggregate.

• vanilla-mixin*

Mixins: standard-object

Description Vanilla-Mixin is automatically inherited by every object created in GDL. Itprovides basic messages which are common to all GDL objects defined with the define-object macro, unless :no-vanilla-mixin t is specified at the toplevel of the define-object form.

Input slots (optional):

Hidden? Boolean

Indicates whether the object should effectively be a hidden-object even if specified in:objects. Default is nil.

Root GDL Instance

The root-level node in this object’s “tree” (instance hierarchy).

Safe-children List of GDL Instances

All objects from the :objects specification, including elements of sequences as flat lists.Any children which throw errors come back as a plist with error information

Strings-for-display String or List of Strings

Determines how the name of objects of this type will be printed in most places. Thisdefaults to the name-for-display (generally the part’s name as specified in its parent),followed by an index number if the part is an element of a sequence.

Visible-children List of GDL Instances

Additional objects to display in Tatu tree. Typically this would be a subset of hidden-children. Defaults to NIL.

Computed slots:

Aggregate GDL Instance

In an element of a sequence, this is the container object which holds all elements.

Page 94: Genworks GDL: A User's Manual - Genworks International

88 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

All-mixins List of Symbols

Lists all the superclasses of the type of this object.

Children List of GDL Instances

All objects from the :objects specification, including elements of sequences as flat lists.

Direct-mixins List of Symbols

Lists the direct superclasses of the type of this object.

First? Boolean

For elements of sequences, T iff there is no previous element.

Hidden-children List of GDL Instances

All objects from the :hidden-objects specification, including elements of sequences as flatlists.

Index Integer

Sequential index number for elements of a sequence, NIL for singular objects.

Last? Boolean

For elements of sequences, T iff there is no next element.

Leaf? Boolean

T if this object has no children, NIL otherwise.

Leaves List of GDL Objects

A Collection of the leaf nodes of the given object.

Name-for-display Keyword symbol

The part’s simple name, derived from its object specification in the parent or from thetype name if this is the root instance.

Next GDL Instance

For elements of sequences, returns the next part in the sequence.

Parent GDL Instance

The parent of this object, or NIL if this is the root object.

Previous GDL Instance

For elements of sequences, returns the previous part in the sequence.

Root-path List of Symbols or of Pairs of Symbol and Integer

Indicates the path through the instance hierarchy from the root to this object. Canbe used in conjunction with the follow-root-path GDL function to return the actualinstance.

Root-path-local List of Symbols or of Pairs of Symbol and Integer

Indicates the path through the instance hierarchy from the local root to this object. Canbe used in conjunction with the follow-root-path GDL function to return the actualinstance.

Root? Boolean

T iff this part has NIL as its parent and therefore is the root node.

Page 95: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE89

Safe-hidden-children List of GDL Instances

All objects from the :hidden-objects specification, including elements of sequences as flatlists. Any children which throw errors come back as a plist with error information

Type Symbol

The GDL Type of this object.

Gdl functions:

Documentation Plist

Returns the :documentation plist which has been specified the specific part type of thisinstance.

Follow-root-path GDL Instance

Using this instance as the root, follow the reference chain represented by the given path.

Message-documentation String

This is synonymous with slot-documentation

Message-list List of Keyword Symbols

Returns the messages (slots, objects, and functions) of this object, according to thefiltering criteria as specified by the arguments.

Mixins List of Symbols

Returns the names of the immediate superclasses of this object.

Restore-all-defaults! Void

Restores all settable-slots in this instance to their default values.

Restore-slot-default! NIL

Restores the value of the given slot to its default, thus “undoing” any forcibly set valuein the slot. Any dependent slots in the tree will respond accordingly when they are nextdemanded. Note that the slot must be specified as a keyword symbol (i.e. prependedwith a colon (“:”)), otherwise it will be evaluated as a variable according to normal Lispfunctional evaluation rules.

Restore-slot-defaults! nil

Restores the value of the given slots to their defaults, thus “undoing” any forcibly setvalues in the slots. Any dependent slots in the tree will respond accordingly when theyare next demanded. Note that the slots must be specified as keyword symbols (i.e.prepended with colons (“:”)), otherwise they will be evaluated as variables according tonormal Lisp functional evaluation rules.

Restore-tree! Void

Restores all settable-slots in this instance, and recursively in all descendant instances,to their default values.

Set-slot! NIL

Forcibly sets the value of the given slot to the given value. The slot must be definedas :settable for this to work properly. Any dependent slots in the tree will respondaccordingly when they are next demanded. Note that the slot must be specified as a

Page 96: Genworks GDL: A User's Manual - Genworks International

90 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

keyword symbol (i.e. prepended with a colon (“:”)), otherwise it will be evaluated as avariable according to normal Lisp functional evaluation rules.

Note also that this must not be called (either directly or indirectly) from within thebody of a Gendl computed-slot. The caching and dependency tracking mechanism inGendl will not work properly if this is called from the body of a computed-slot, andfurthermore a runtime error will be generated.

Set-slots! NIL

Forcibly sets the value of the given slots to the given values. The slots must be definedas :settable for this to work properly. Any dependent slots in the tree will respondaccordingly when they are next demanded. Note that the slots must be specified as akeyword symbols (i.e. prepended with a colon (“:”)), otherwise they will be evaluatedas variables according to normal Lisp functional evaluation rules.

Slot-documentation Plist of Symbols and Strings

Returns the part types and slot documentation which has been specified for the givenslot, from most specific to least specific in the CLOS inheritance order. Note that theslot must be specified as a keyword symbol (i.e. prepended with a colon (“:”)), otherwiseit will be evaluated as a variable according to normal Lisp functional evaluation rules.

Slot-source Body of GDL code, in list form

.

Slot-status Keyword symbol

Describes the current status of the requested slot:

1. :unbound: it has not yet been demanded (this could mean either it has never beendemanded, or something it depends on has been modified since the last time it wasdemanded and eager setting is not enabled).

2. :evaluated: it has been demanded and it is currently bound to the default valuebased on the code.

3. :set: (for :settable slots only, which includes all required :input-slots) it has beenmodified and is currently bound to the value to which it was explicitly set.

4. :toplevel: (for root-level object only) its value was passed into the root-level objectas a toplevel input at the time of object instantiation.

Update! Void

Uncaches all cached data in slots and objects throughout the instance tree from thisnode, forcing all code to run again the next time values are demanded. This is usefulfor updating an existing model or part of an existing model after making changes andrecompiling/reloading the code of the underlying definitions. Any set (modified) slotvalues will, however, be preserved by the update.

Write-snapshot Void

Writes a file containing the toplevel inputs and modified settable-slots starting from theroot of the current instance. Typically this file can be read back into the system usingthe read-snapshot function.

• variable-sequence

Mixins: quantification

Page 97: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE91

Description A variable-sequence quantification is generated as a result of specifying :sequence

(:indices ...)) in an :objects specification. Unlike a normal sequence quantifica-tion (specified with :sequence (:size ...))), elements can be surgically inserted anddeleted from a variable-sequence.

Computed slots:

First GDL Object

Returns the first element of the aggregate.

Last GDL Object

Returns the last element of the aggregate.

Gdl functions:

Delete! Void

Deletes the element identified with the given index.

Insert! Void

Inserts a new element identified with the given index.

Reset! Void

Resets the variable sequence to its default list of indices (i.e. clears out any inserted ordeleted elements and re-evaluates the expression to compute the original list of indices)

11.8.2 Function and Macro Definitions

• alist2plist

(type Plist intro Converts an assoc-list to a plist. arguments (alist Assoc-List))

• always

(type T intro Always returns the value ¡tt¿T¡/tt¿ regardless of ¡b¿arg¡/b¿. arguments (argLisp object. Ignored))

• append-elements [Macro]

(type List of Objects [Macro] intro Returns an appended list of ¡tt¿expression¡/tt¿ from eachelement of an aggregate, with an optional filter. arguments (aggregate GDL aggregate object.(e.g. from a ¡tt¿:sequence (:size ..)¡/tt¿ ¡tt¿:object¡/tt¿ specification).) &optional (expressionExpression using ¡tt¿the-element¡/tt¿. Similar to a ¡tt¿the-object¡/tt¿ reference, which shouldreturn a list.))

• check-computed-slots

(type nil intro computed-slots grammar: ¡form¿ = :computed-slots (¡token¿*) ¡token¿ =¡string¿ — (¡string¿* ¡symbol¿ ¡expression¿+ ¡behavior¿+) ¡behavior¿ = :settable — :un-cached Also check for special case in which only strings without a symbol following. )

• check-documentation

(type nil intro plist containing keys :description :author :examples :date :version )

Page 98: Genworks GDL: A User's Manual - Genworks International

92 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• check-floating-string

(type nil intro check for special case in which documentation isn’t followed by symbol spec )

• check-form

(type nil intro general function that, given a predicate, validates all tokens in a slot declarationform )

• check-functions

(type Void intro Checks :functions or :methods grammar according to following BNF: ¡form¿= :functions — :methods (¡token¿*) ¡token¿ = (¡string¿* ¡symbol¿ ¡behavior¿+ ¡list¿ ¡body¿)¡behavior¿ = :cached — :cached-eql — :cached-= — :cached-eq — :cached-equal — :cached-equalp )

• check-input-slots

(type nil intro input-slots grammar: ¡form¿ = :input-slots (¡token¿*) ¡token¿ = ¡string¿ —¡symbol¿ — (¡string¿* ¡symbol¿ ¡expression¿+ ¡behavior¿*) ¡behavior¿ = :settable — :default-ing Also check for special case in which only strings without a symbol following. )

• check-objects

(type nil intro (hidden-) grammar: ¡form¿ = (hidden-):objects (¡token¿*) ¡token¿ = (¡string¿*¡symbol¿ ¡rule¿*) ¡rule¿ = ¡keyword¿ ¡expression¿ )

• check-query-slots

(type nil intro unknown what is is )

• check-trickle-down-slots

(type nil intro functions — :methods grammar: ¡form¿ = :trickle-down-slots (¡symbol¿*) )

• cl-lite

(type nil intro Traverses pathname in an alphabetical depth-first order, compiling and loadingany lisp files found in source/ subdirectories. A lisp source file will only be compiled if it isnewer than the corresponding compiled fasl binary file, or if the corresponding compiledfasl binary file does not exist. A bin/source/ will be created, as a sibling to each source/subdirectory, to contain the compiled fasl files. If the :create-fasl? keyword argument isspecified as non-nil, a concatenated fasl file, named after the last directory component ofpathname, will be created in the (glisp:temporary-directory). [Note: this new documentationstill needs proper formatting] If the :create-asd-file? keyword argument is specified as non-nil, a .asd file suitable for use with ASDF will be emitted into the directory indicated by thepathname argument. Note that ASDF (Another System Definition Utility), possibly withhelp of Quicklisp, is (as of 2013-03-12) the recommended way for handling Common Lispsystem modules. As of version 2.31.9, ASDF is also capable of generating fasl ”bundle” filesas with the :create-fasl? argument to cl-lite. For the :author, :version, and :license argumentsin the generated .asd file, the files author.isc, version.isc, and license.isc, respectively, areconsulted, if they exist. They are searched for first in the codebase toplevel directory (thepathname argument to this function), then in the (user-homedir-pathname). The version

Page 99: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE93

defaults to the current ISO-8601 date without dashes, e.g. ”20130312”. Please see theGenworks Documentation for an overview of Quicklisp and ASDF, and see the Quicklispand ASDF project documentation for detailed information. The source code for Quicklispand ASDF should also be included with your Gendl distribution, and these are typicallyloaded by default into the development environment. For additional inputs to the cl-litefunction, please see codebase-directory-node object for additional inputs (which can be givenas keyword args to this function). )

• cyclic-nth

(type Lisp object intro Returns nth from the list, or wraps around if nth is greater than thelength of the list. )

• defaulting [Macro]

(type Lisp object intro Returns a default value if the reference-chain is not handled. arguments(form Reference-chain with the or the-object default Lisp expression. Default value to returnif reference-chain cannot be handled.))

• define-format [Macro]

(type Standard-class [Macro] intro Defines a standard GDL output format for use with GDLviews. arguments (name Symbol. mixin-list List of symbols.) &key (documentation Plistcontaining keys and strings for author, description, etc. slots List of lists or symbols. If alist, the list should contain a symbol, a default value, and optionally a documentation string.If a symbol, this is the name of the slot and there will be no default value. functions List offormat-function definitions. Each definition is made up of a symbol, an argument-list, and abody.))

• define-lens [Macro]

(type Void [Macro] intro Defines output-functions for the combination of the given output-format and GDL object. arguments (format-and-object List of two symbols. The first shouldname an output-format previously defined with ¡tt¿define-format¡/tt¿, and the second shouldname a GDL object previously defined with ¡tt¿define-object¡/tt¿. mixin-list NIL. This isnot supported and should be left as NIL or an empty list for now.) &key ((skin t) Name ofa skin defined with define-skin. This allows a class hierarchy of look and feel for each viewcombination. Defaults to T, a generic skin.))

• define-object [Macro]

(type Defines a standard GDL object intro Please see the document USAGE.TXT for anoverview of ¡tt¿define-object¡/tt¿ syntax. )

• define-object-amendment [Macro]

(type Supplements or alters an existing GDL object definition intro Syntax is similar to thatfor ¡tt¿define-object¡/tt¿. Note that there is currently no way to undefine messages definedwith this macro, other than redefining the original object or restarting the GDL session.Support for surgically removing messages will be added in a future GenDL release. )

Page 100: Genworks GDL: A User's Manual - Genworks International

94 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• div

(type Floating-point number intro Divides using rational division and converts the result(which may be a pure rational number) to a floating-point number. arguments (numeratorNumber. denominator Number.) &optional (more-denominators (&rest). More numbers todivide by.))

• ensure-list

(type List intro If argument is not list, returns it in a list. If argument is a list, returns itunchanged. arguments (possible-list Lisp object))

• find-dependants

(type List of pairs of instance/keyword intro Synonymous with find-messages-used-by. )

• find-dependencies

(type List of pairs of instance/keyword intro Synonymous with find-messages-which-use. )

• find-messages-used-by

(type List of pairs of instance/keyword intro This returns the list of direct dependants of agiven message in a given instance. Note that this is not recursive; if you want to generate atree, then you have to call this recursively yourself. If you want an easy way to remember themeaning of dependant and dependency: You have a dependency on caffeine. Your childrenare your dependants. )

• find-messages-which-use

(type List of pairs of instance/keyword intro This returns the list of direct dependencies of agiven message in a given instance. Note that this is not recursive; if you want to generate atree, then you have to call this recursively yourself. If you want an easy way to remember themeaning of dependant and dependency: You have a dependency on caffeine. Your childrenare your dependants. )

• flatten

(type List intro Returns a new list consisting of only the leaf-level atoms from ¡b¿list¡/b¿.Since nil is technically a list, ¡tt¿flatten¡/tt¿ also has the effect of removing nils from ¡b¿list¡/b¿,but may be inefficient if used only for this purpose. For removing nil values from a list, con-sider using ¡tt¿remove nil ...¡/tt¿ instead. note from On Lisp by Paul Graham, code as follows:¡pre¿ (if (atom tree) (ensure-list tree) (nconc (flatten (car tree)) (if (cdr tree) (flatten (cdrtree))))) ¡/pre¿ arguments (list List) see-also ¡tt¿remove¡/tt¿ )

• format-slot [Macro]

(type Lisp object [Macro] intro Returns the value of the given slot within the context of thecurrent ¡tt¿with-format¡/tt¿ output format object. arguments (slot-name Symbol.))

• fround-to-nearest

(type Number intro Rounds ¡b¿number¡/b¿ to the nearest ¡b¿interval¡/b¿, using type conta-gion rules for floating-point similar to the CL ”fround” function. arguments (number Numberinterval Number))

Page 101: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE95

• half

(type Number intro Returns the result of dividing ¡b¿num¡/b¿ by the integer ¡tt¿2¡/tt¿. Thetype of the returned number will depend on the type of ¡b¿num¡/b¿. arguments (num Num-ber))

• ignore-errors-with-backtrace [Macro]

(type Like IGNORE-ERRORS, but in case of failure, return backtrace string as third valueintro . )

• index-filter

(type List intro Returns all elements of ¡b¿list¡/b¿ for whose index (starting at zero) thefunction ¡b¿fn¡/b¿ returns non-NIL. arguments (fn Function object (e.g. a lambda expression)list List))

• iso-8601-date

(type String intro Returns the ISO8601 formatted date and possibly time from a CommonLisp universal time integer, e.g. 2007-11-30 or 2007-11-30T13:45:10 )

• lastcar

(type Lisp Object intro Returns the last element of ¡b¿list¡/b¿. arguments (list List))

• least

(type List intro Returns the member of ¡b¿list¡/b¿ which returns the minimum numericalvalue when ¡b¿function¡/b¿ is applied to it. As second value is returned which is the actualminimum value (the return-value of ¡b¿function¡/b¿ as applied). This function comes fromthe Paul Graham book ¡u¿ANSI Common Lisp¡/u¿. arguments (function Function list List))

• list-elements [Macro]

(type List of GDL Objects [Macro] intro Returns a listing of the elements of an aggregate,with an optional ¡tt¿the-element¡/tt¿ expression and filter. If an expression is given, the listof results from the expressions is returned. If no expression is given, a list of the objects them-selves is returned. arguments (aggregate GDL aggregate object. (e.g. from a ¡tt¿:sequence(:size ..)¡/tt¿ ¡tt¿:object¡/tt¿ specification).) &optional (expression Expression using ¡tt¿the-element¡/tt¿. Similar to a ¡tt¿the-object¡/tt¿ reference. filter Function of one argument. Canbe used to filter the result list.))

• list-of-n-numbers

(type Returns a list of n numbers equally spaced between bounds num1 and num2, inclusiveintro . )

• list-of-numbers

(type List of Numbers intro Returns a list of incrementing numbers starting from ¡b¿num1¡/b¿and ending with ¡b¿num2¡/b¿, inclusive. Increment can be positive for num1 ¡ num2, ornegative for num1 ¿ num2. This version was contributed by Reinier van Dijk. arguments(num1 Number num2 Number) &optional ((increment 1) Number. The distance between thereturned listed numbers. (tolerance (/ increment 10)) Number. tolerance for increment.))

Page 102: Genworks GDL: A User's Manual - Genworks International

96 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• load-quicklisp

(type Void intro This is intended for pre-built Gendl or GDL images. If the preconfiguredquicklisp load file exists, load it. You can customize quicklisp location by setting global*quicklisp-home* or passing :path keyword argument to this function. &key ((path *quicklisp-home*) Pathname or string. Quicklisp location.))

• make-keyword

(type Keyword symbol intro Converts given strings to a keyword. If any of the given argu-ments is not a string, it will be converted to one with (format nil ” a” string). arguments(strings &rest Strings))

• make-object

(type GDL Object intro Instantiates an object with specified initial values for input-slots.arguments (object-name Symbol. Should name a GDL object type. arguments spliced-inplist. A plist of keyword symbols and values for initial ¡tt¿input-slots¡/tt¿.))

• mapsend

(type List intro Returns a new list which is the result of sending ¡b¿message¡/b¿ to each GDLobject in ¡b¿object-list¡/b¿. arguments (object-list List of GDL objects. message Keywordsymbol.))

• maptree

(type List intro Returns the results of applying ¡b¿fn¡/b¿ to each GDL object in the objecttree rooted at ¡b¿node¡/b¿ in a “depth-first” tree traversal. arguments (node GDL objectfn Function. Operates on a single argument which is a GDL object) &optional ((accept?#’always) Function. Determines which nodes to accept in the final result (prune? #’never)Function. Determines which nodes to prune from the tree traversal (get-children children)Keyword symbol :children or Function. Function applied to a given node to get its children.The default, keyword symbol :children, uses the node’s normal children as returned by (the-object node children).))

• max-of-elements [Macro]

(type Number [Macro] intro Returns the maximum of ¡tt¿expression¡/tt¿ from each element ofan aggregate, with an optional filter. arguments (aggregate GDL aggregate object. (e.g. froma ¡tt¿:sequence (:size ..)¡/tt¿ ¡tt¿:object¡/tt¿ specification).) &optional (expression Expressionusing ¡tt¿the-element¡/tt¿. Similar to a ¡tt¿the-object¡/tt¿ reference, which should return anumber.))

• min-of-elements [Macro]

(type Number [Macro] intro Returns the minimum of ¡tt¿expression¡/tt¿ from each element ofan aggregate, with an optional filter. arguments (aggregate GDL aggregate object. (e.g. froma ¡tt¿:sequence (:size ..)¡/tt¿ ¡tt¿:object¡/tt¿ specification).) &optional (expression Expressionusing ¡tt¿the-element¡/tt¿. Similar to a ¡tt¿the-object¡/tt¿ reference, which should return anumber.))

Page 103: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE97

• most

(type List intro Returns the member of ¡b¿list¡/b¿ which returns the maximum numericalvalue when ¡b¿function¡/b¿ is applied to it. As second value is returned which is the actualmaximum value (the return-value of ¡b¿function¡/b¿ as applied). This function comes fromthe Paul Graham book ¡u¿ANSI Common Lisp¡/u¿. arguments (function Function list List))

• near-to?

(type Boolean intro Predicate to test if number is within tolerance of ¡b¿near-to¡/b¿. Thedefault tolerance is the value of the parameter ¡tt¿*zero-epsilon*¡/tt¿. arguments (numberNumber near-to Number) &optional ((tolerance *zero-epsilon*) Number))

• near-zero?

(type Boolean intro Returns non-NIL iff ¡b¿number¡/b¿ is greater than ¡b¿tolerance¡/b¿ differ-ent from zero. arguments (number Number) &optional ((tolerance *zero-epsilon*) Number)see-also ¡tt¿zerop¡/tt¿ (Common Lisp function) )

• never

(type NIL intro Always returns the value ¡tt¿NIL¡/tt¿ regardless of ¡b¿arg¡/b¿. arguments(arg Lisp object. Ignored))

• number-format

(type String intro Returns a string displaying ¡b¿number¡/b¿ rounded to ¡b¿decimal-places¡/b¿decimal places. arguments (number Number decimal-places Integer))

• number-round

(type Number intro Returns ¡b¿number¡/b¿ rounded to ¡b¿decimal-places¡/b¿ decimal places.arguments (number Number decimal-places Integer))

• plist-keys

(type List of keyword symbols intro Returns the keys from a plist. arguments (plist Plist))

• plist-values

(type List of Lisp objects intro Returns the values from a plist. arguments (plist Plist))

• print-messages [Macro]

(type [Macro] Void intro Prints the specified GDL object messages (i.e. slots) and theircurrent values to standard output. arguments (vars unquoted symbols (&rest argument)))

• print-variables [Macro]

(type [Macro] Void intro Prints the specified variables and current values to standard output.arguments (vars unquoted symbols (&rest argument)))

• query-collect

(type List of row objects intro Returns all the rows from a query, or if a key is given, returnsthe values from the column named with the key. &optional (key Keyword symbol. If given,the values from this named column will be returned, rather than the entire row objects.))

Page 104: Genworks GDL: A User's Manual - Genworks International

98 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• read-safe-string

(type Lisp object intro Reads an item from string, protecting against lisp evaluation withthe ‘#.’ reader macro. Throws an error if evaluation would have occured. arguments (stringstring))

• read-snapshot

(type GDL Instance intro Reads the snapshot data from stream, from the string, or from fileindicated by filename. If no optional keyword ¡tt¿object¡/tt¿ argument is given, a new GDLinstance based on the data in the snapshot file is returned. If an ¡tt¿object¡/tt¿ is given, theobject should be compatible in type to that specified in the snapshot file, and this existingobject will be modified to contain the set slot values and toplevel inputs as specified in thesnapshot file. &key ((filename /tmp/snap.gdl) String or pathname. File to be read. If eitherstring or stream is specified, this will not be used. (string nil) String of data. The actualsnapshot contents, stored in a string. If stream is specified, this will not be used. (stream nil)Stream open for input. A stream from which the snapshot data can be read. (keep-bashed-values? nil) Boolean. Indicates whether to keep the currently bashed values in object beforereading snap values into it. (object nil) GDL object. Existing object to be modified withrestored values.))

• remove-plist-entry

(type Plist intro Returns a new plist sans any key/value pairs where the plist key is eql tothe given key. Optionally a different test than #’eql can be specified with the :test keywordargument. arguments (plist Plist. The source plist. key matching key, typically a keywordsymbol. The key to target for removal.) &key ((test #’eql) predicate equality function takingtwo arguments. The function to use for matching.) examples (remove-plist-entry (list :a ”a”:b :a) :a) )

• round-to-nearest

(type Number intro Rounds ¡b¿number¡/b¿ to the nearest ¡b¿interval¡/b¿. arguments (numberNumber interval Number))

• safe-float

(type Double-float Number intro Coerces ¡b¿number¡/b¿ to a double-precision floating-pointnumber if possible. If this is not possible, returns ¡tt¿0.0d0¡/tt¿ (i.e. zero in the form of adouble-precision floating-point number). arguments (number Number))

• safe-sort

(type List intro Nondestructive analog of the Common Lisp ¡tt¿sort¡/tt¿ function. Returns afreshly created list. arguments (list List. The list to be sorted.) &rest (args Argument list.Identical to the arguments for Common Lisp ¡tt¿sort¡/tt¿.))

• set-format-slot [Macro]

(type Void [Macro] intro Sets the value of the given slot within the context of the current¡tt¿with-format¡/tt¿ output format object. arguments (slot-name Symbol. value Lisp Value))

Page 105: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE99

• split

(type List of Strings intro Returns a list containing the elements of ¡b¿string¡/b¿ after havingbeen split according to ¡b¿split-chars¡/b¿ as delimiting characters. arguments (string String)&optional ((split-chars (list

)) List of characters) see-also ¡tt¿glisp:split-regexp¡/tt¿ )

• status-message

(type NIL intro Prints ¡b¿string¡/b¿, followed by a newline, to ¡tt¿*trace-output*¡/tt¿, whichis generally the system console. arguments (string String))

• string-append

(type String intro Returns a new string made up of concatenating the arguments. arguments(&rest (args strings)))

• sum-elements [Macro]

(type Number [Macro] intro Returns the sum of ¡tt¿expression¡/tt¿ from each element of anaggregate, with an optional filter. arguments (aggregate GDL aggregate object. (e.g. from a¡tt¿:sequence (:size ..)¡/tt¿ ¡tt¿:object¡/tt¿ specification).) &optional (expression Expressionusing ¡tt¿the-element¡/tt¿. Similar to a ¡tt¿the-object¡/tt¿ reference, which should return anumber.))

• the [Macro]

(type Lisp object intro Sends the ¡tt¿reference-chain¡/tt¿ to ¡tt¿self¡/tt¿, which typicallymeans it is used within the context of a define-object where self is automatically lexicallybound. arguments (reference-chain (&rest). A spliced-in list of symbols naming messages,which can be slots or objects starting from ¡tt¿self¡/tt¿. For referring to elements of a quan-tified set, or for passing arguments to GDL functions which take arguments, use parenthesesaround the message name and enclose the quantified element index or function argumentsafter the message name.) example This example sends the ¡tt¿length¡/tt¿ message to the“zeroth” element of the quantified set of arms contained in the body which is contained inthe robot which is contained in self: ¡pre¿ (the robot body (arms 0) length) ¡/pre¿ )

• the-child [Macro]

(type similar to “the,” but used to refer to the child part from within an :objects or :hidden-objects specification intro . This is often used for sending the ¡tt¿index¡/tt¿ message to anelement of a quantified set. arguments (reference-chain (&rest). A spliced-in list of symbolsnaming messages relative to the child object.))

• the-element [Macro]

(type Lisp Object [Macro] intro Acts similarly to ¡tt¿the-object¡/tt¿ for each element of anaggregate, within the context of a ¡tt¿list-elements¡/tt¿, ¡tt¿append-elements¡/tt¿, ¡tt¿max-of-elements¡/tt¿, ¡tt¿min-of-elements¡/tt¿, ¡tt¿sum-elements¡/tt¿, or a query operator (queryoperators are not yet documented). arguments (args (&rest). Standard reference chain ap-plicable to the element.))

Page 106: Genworks GDL: A User's Manual - Genworks International

100 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• the-object [Macro]

(type Lisp object intro Sends the ¡tt¿reference-chain¡/tt¿ to ¡tt¿object¡/tt¿, which must bespecified as a Lisp expression (e.g. a variable) which evaluates to a GDL object. arguments(reference-chain (&rest). A spliced-in list of symbols naming messages, which can be slotsor objects starting from ¡tt¿object¡/tt¿. For referring to elements of a quantified set, or forpassing arguments to GDL functions which take arguments, use parentheses around the mes-sage name and enclose the quantified element index or function arguments after the messagename.) example This example sends the ¡tt¿length¡/tt¿ message to the “zeroth” element ofthe quantified set of arms contained in the body which is contained in the robot which iscontained in ¡tt¿object¡/tt¿: ¡pre¿ (the-object object robot body (arms 0) length) ¡/pre¿ )

• twice

(type Number intro Returns the result of multiplying ¡b¿num¡/b¿ by the integer ¡tt¿2¡/tt¿.The type of the returned number will depend on the type of ¡b¿num¡/b¿. arguments (numNumber))

• undefine-object

(type NIL intro Clears all definitions associated with ¡b¿object-name¡/b¿ from the currentlyrunning GDL session. arguments (object-name Non-keyword Symbol naming a GDL objecttype))

• universal-time-from-iso-8601

(type Integer representing Common Lisp Universal Time intro Returns the universal timefrom a date formatted as an iso-8601 date, optionally with time, e.g. 2012-07-08 or 2012-07-08T13:33 or 2012-07-08T13:33:00 )

• with-error-handling [Macro]

(type [Macro] intro Wraps the ¡b¿body¡/b¿ of code with error-trapping and system timeout.A warning is given if an error condition occurs with ¡b¿body¡/b¿. &key ((timeout 2) Timeoutin Seconds. timeout-body Body of code to evaluate if timeout occurs. Default is to print awarning and return nil.) &rest (body Body of code to be wrapped))

• with-format [Macro]

(type Void [Macro] intro Used to establish an output format and a stream to which datais to be sent. This supports a full range of output options such as page dimensions, viewtransforms, view scales, etc. example ¡pre¿ (gdl::with-format (pdf ”/tmp/box.pdf” :view-transform (getf *standard-views* :trimetric)) (write-the-object (make-instance ’box :length100 :width 100 :height 100) cad-output)) ¡/pre¿ )

• with-format-slots [Macro]

(type Void [Macro] intro Wrap this around a body of code which should have access to multipleslots from the context of the current ¡tt¿with-format¡/tt¿ output format object. arguments(slots List of Symbols.))

Page 107: Genworks GDL: A User's Manual - Genworks International

11.8. GENDL (BASE CORE KERNEL ENGINE) NICKNAMES: GDL, GENWORKS, BASE101

• write-env [Macro]

(type Void [Macro] (usually used just for outputting) intro Within the context of a ¡tt¿with-format¡/tt¿, calls functions of the format object, optionally with arguments. Typically thesefunctions will output data to the ¡tt¿stream¡/tt¿ established by the ¡tt¿with-format¡/tt¿.arguments (function-calls (&rest). Functions on the named output-format to be called.)example ¡pre¿ (with-format (base-format my-object) (write-env (:a ”Hello World, my object’slength is: ”) (:a (the length)))) ¡/pre¿ )

• write-plist

(type Pretty-prints a plist to a file with standard I/O syntax intro . &key ((plist nil) List.The list to be printed to the file (output-path nil) Pathname of a file. The file to be createdor superseded.))

• write-the [Macro]

(type Lisp object [Macro] intro Typcially used only to send output, not for the return value.This macro is used within the body of a ¡tt¿with-format¡/tt¿. It sends the ¡tt¿reference-chain¡/tt¿ to ¡tt¿self¡/tt¿, which typically means it is used within the context of a define-object where self is automatically lexically bound. The reference-chain must terminate withan output-function defined for the combination of the output-format specified in the enclosing¡tt¿with-format¡/tt¿, and the object identified by ¡tt¿self¡/tt¿. arguments (reference-chain(&rest). A spliced-in list of symbols naming messages, which can be slots or objects startingfrom ¡tt¿self¡/tt¿, terminating with the name of an output-function. For referring to elementsof a quantified set, or for passing arguments to GDL functions which take arguments, useparentheses around the message name and enclose the quantified element index or functionarguments after the message name.))

• write-the-object [Macro]

(type Lisp object [Macro] intro Typcially used only to send output, not for the return value.This macro is used within the body of a ¡tt¿with-format¡/tt¿. It sends the ¡tt¿reference-chain¡/tt¿ to ¡tt¿object¡/tt¿, which must be specified as a Lisp expression (e.g. a variable)which evaluates to a GDL object. The reference-chain must terminate with an output-function defined for the combination of the output-format specified in the enclosing ¡tt¿with-format¡/tt¿, and the object identified by ¡tt¿object¡/tt¿. arguments (reference-chain (&rest).A spliced-in list of symbols naming messages, which can be slots or objects starting from¡tt¿object¡/tt¿, terminating with the name of an output-function. For referring to elementsof a quantified set, or for passing arguments to GDL functions which take arguments, useparentheses around the message name and enclose the quantified element index or functionarguments after the message name.))

• hat-2

(type Number intro Return ¡b¿number¡/b¿ raised to the power two (2). arguments (numberNumber))

11.8.3 Variables and Constants

• *color-plist*

Page 108: Genworks GDL: A User's Manual - Genworks International

102 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• *color-table*

• *color-table-decimal*

• *colors-default*

• *compile-circular-reference-detection?*

• *compile-dependency-tracking?*

• *compile-documentation-database?*

• *compile-for-dgdl?*

• *compile-source-code-database?*

• *curve-chords*

• *ensure-lists-when-bashing?*

• *load-documentation-database?*

• *load-source-code-database?*

• *on-syntax-error*

• *out-of-bounds-sequence-reference-action*

• *remember-previous-slot-values?*

• *root-checking-enabled?*

• *run-with-circular-reference-detection?*

• *run-with-dependency-tracking?*

• *sort-children?*

• *undeclared-parameters-enabled?*

• *with-format-direction

• *with-format-element-type*

• *with-format-external-format*

• *with-format-if-does-not-exist*

• *with-format-if-exists*

• *zero-epsilon*

• +phi+

• 2pi

• pi/2

Page 109: Genworks GDL: A User's Manual - Genworks International

11.9. GDL-USER 103

(in-package :gdl-user)

(define-object angular-dimension-test (base-object)

:objects

((arc :type ’arc

:display-controls (list :color :green )

:radius 30

:end-angle (degrees-to-radians 90))

(dimension :type ’angular-dimension

:display-controls (list :color :blue )

:leader-radius (+ (* 0.1 (the arc radius))(the arc radius))

:arc-object (the arc))

(explicit-dimension :type ’angular-dimension

:center-point (the arc center)

:start-point (the arc (point-on-arc (degrees-to-radians 10)))

:end-point (the arc (point-on-arc (degrees-to-radians 60))))))

(generate-sample-drawing

:objects (list

(the-object (make-object ’angular-dimension-test) arc)

(the-object (make-object ’angular-dimension-test) dimension)

(the-object (make-object ’angular-dimension-test) explicit-dimension))

:projection-direction (getf *standard-views* :top))

Figure 11.1: Example Code for angular-dimension

11.9 gdl-user

11.10 gendl-doc

11.11 genworks-gdl (Genworks GDL)

11.12 geom-base (Wireframe Geometry)

11.12.1 Object Definitions

• angular-dimension

Mixins: linear-dimension, vanilla-mixin

Description This dimensional object produces a clear and concise arc dimensional annota-tion.

Input slots (required):

Page 110: Genworks GDL: A User's Manual - Genworks International

104 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

90.0

50.0

Figure 11.2: angular-dimension example

Arc-object GDL object

The arc being measured.

Input slots (optional):

Center-point 3D Point

The center of the arc being measured.

Dim-text-start 3D Point

Determines where the text will start. Defaults to halfway along the arc, just beyond theradius.

End-point 3D Point

The end point of the arc being measured.

Leader-radius Number

The radius for the leader-arc.

Start-point 3D Point

The start point of the arc being measured.

Text-along-leader-padding-factor Number

Amount of padding above leader for text-along-leader? t. This is multiplied by thecharacter-size to get the actual padding amount. Defaults to 1/3.

Witness-1-to-center? Boolean

Determines whether a witness line extends all the way from the start-point to the center.Defaults to nil.

Page 111: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 105

(in-package :gdl-user)

(define-object arc-sample (arc)

:computed-slots ((radius 30) (end-angle (half pi/2))))

(generate-sample-drawing :objects (make-object ’arc-sample))

Figure 11.3: Example Code for arc

Figure 11.4: arc example

Witness-2-to-center? Boolean

Determines whether a witness line extends all the way from the end-point to the center.Defaults to nil.

Computed slots:

Dim-value Number

2D distance relative to the base-plane-normal. Can be over-ridden in the subclass

• arc

Mixins: arcoid-mixin, base-object

Description A segment of a circle. The start point is at the 3 o’clock position, and positiveangles are measured anti-clockwise.

Page 112: Genworks GDL: A User's Manual - Genworks International

106 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Input slots (required):

Radius Number

Distance from center to any point on the arc.

Input slots (optional):

End-angle Angle in radians

End angle of the arc. Defaults to twice pi.

Start-angle Angle in radians

Start angle of the arc. Defaults to zero.

Computed slots:

End 3D Point

The end point of the arc.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Start 3D Point

The start point of the arc.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Gdl functions:

Equi-spaced-points List of points

Returns a list of points equally spaced around the arc, including the start and end pointof the arc.

Point-on-arc 3D Point

The point on the arc at a certain angle from the start.

Tangent 3D Vector

Returns the tangent to the arc at the given point (which should be on the arc).

• arcoid-mixin

Mixins: vanilla-mixin

Description This object is a low level object used to define an arc like object. It is notrecommended to be used directly by GDL common users. For developers it should beused as a mixin.

Input slots (required):

Page 113: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 107

Radius Number

Distance from center to any point on the arc.

Input slots (optional):

End-angle Angle in radians

End angle of the arc. Defaults to twice pi.

Start-angle Angle in radians

Start angle of the arc. Defaults to zero.

• base-coordinate-system

Mixins: base-object, vanilla-mixin

Description This provides a default 3D Cartesian coordinate system. It mixes in base-object and does not extend it in any way, so as with base-object, it provides an imaginarygeometric reference box with a length, width, height, center, and orientation.

• base-drawing

Mixins: base-object

Description Generic container object for displaying one or more scaled transformed viewsof geometric or text-based entities. The contained views are generally of type base-view.In a GWL application-mixin, you can include one object of this type in the ui-display-list-leaves.

For the PDF output-format, you can also use the cad-output output-function to writethe drawing as a PDF document.

Since base-drawing is inherently a 2D object, only the top view (getf *standard-views*:top) makes sense for viewing it.

Input slots (optional):

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Page-length Number in PDF Points

Front-to-back (or top-to-bottom) length of the paper being represented by this drawing.The default is (* 11 72) points, or 11 inches, corresponding to US standard letter-sizepaper.

Page-width Number in PDF Points

Left-to-right width of the paper being represented by this drawing. The default is (* 8.572) points, or 8.5 inches, corresponding to US standard letter-size paper.

Page 114: Genworks GDL: A User's Manual - Genworks International

108 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object cylinder-sample (cylinder)

:computed-slots

((display-controls (list :color :pink-spicy))

(length 10)

(radius 3)

(number-of-sections 25)))

(define-object base-drawing-sample (base-drawing)

:objects

((main-view :type ’base-view

:projection-vector (getf *standard-views* :trimetric)

:object-roots (list (the surf)))

(surf :type ’cylinder-sample

:hidden? t)))

(generate-sample-drawing :objects (make-object ’base-drawing-sample))

Figure 11.5: Example Code for base-drawing

Figure 11.6: base-drawing example

Page 115: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 109

Width Number

X-axis dimension of the reference box. Defaults to zero.

• base-object

Mixins: vanilla-mixin

Description Base-Object is a superclass of most of GDL’s geometric primitives. It pro-vides an imaginary geometric reference box with a length, width, height, center, andorientation.

Input slots (optional):

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Image-file Pathname or string

Points to a pre-existing image file to be displayed instead of actual geometry for thisobject. Defaults to nil

Local-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding this geometric object.

Obliqueness 3x3 Orthonormal Matrix of Double-Float Numbers

This is synonymous with the orientation.

Onclick-function Lambda function of zero arguments, or nil

If non-nil, this function gets invoked when the user clicks the object in graphics front-ends which support this functionality, e.g. SVG/Raphael and X3DOM.

Input slots (optional, defaulting):

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

Display-controls Plist

May contain keywords and values indicating display characteristics for this object. Thefollowing keywords are recognized currently:

:color color keyword from the *color-table* parameter, or an HTML-style hexidecimalRGB string value, e.g. ”#FFFFFF” for pure white. Defaults to :black.

:line-thickness an integer, defaulting to 1, indicating relative line thickness for wire-frame representations of this object.

:dash-pattern (currently PDF/PNG/JPEG only). This is a list of two or three num-bers which indicate the length, in pixels, of the dashes and blank spaces in a dashedline. The optional third number indicates how far into the line or curve to start thedash pattern.

Page 116: Genworks GDL: A User's Manual - Genworks International

110 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object tower (base-object)

:input-slots

((number-of-blocks 50) (twist-per-block 1)

(block-height 1) (block-width 5) (block-length 7))

:objects

((blocks :type ’box

:sequence (:size (the number-of-blocks))

:center (translate (the center)

:up (* (the-child index)

(the-child height)))

:width (the block-width)

:height (the block-height)

:length (the block-length)

:orientation (alignment

:rear (if (the-child first?)

(rotate-vector-d (the (face-normal-vector :rear))

(the twist-per-block)

(the (face-normal-vector :top)))

(rotate-vector-d (the-child previous

(face-normal-vector :rear))

(the twist-per-block)

(the (face-normal-vector :top))))

:top (the (face-normal-vector :top))))))

;;

;;Test run

;;

#|

gdl-user(46): (setq self (make-object ’tower))

#tower @ #x750666f2

gdl-user(47): (setq test-center (the (blocks 10) center))

#(0.0 0.0 10.0)

gdl-user(48): (the (blocks 10) (global-to-local test-center))

#(0.0 0.0 0.0)

gdl-user(49): (the (blocks 10) (local-to-global (the (blocks 10)

(global-to-local test-center))))

#(0.0 0.0 10.0)

gdl-user(50):

gdl-user(50): (setq test-vertex (the (blocks 10) (vertex :top :right :rear)))

#(1.7862364748012536 3.9127176305081863 10.5)

gdl-user(51): (the (blocks 10) (global-to-local test-vertex))

#(2.500000000000001 3.500000000000001 0.5)

gdl-user(52): (the (blocks 10) (local-to-global (the (blocks 10)

(global-to-local test-vertex))))

#(1.786236474801254 3.9127176305081877 10.5)

gdl-user(53):

|#

;;

;;

;;

Figure 11.7: Example Code for base-object

Page 117: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 111

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

Width Number

X-axis dimension of the reference box. Defaults to zero.

Computed slots:

Color-decimal Vector of three real numbers

The RBG color of this object specified in :display-controls. Defaults to the foregroundcolor specified in *colors-default*. This message should not normally be overriddenin user application code.

Local-center 3D Point

The center of this object, from the perspective of the parent. Starting from the parent’scenter and using the parent’s orientation, this is the relative center of this object.

Local-center* 3D Point

The center of this object, from the perspective of the parent. Starting from the parent’scenter and using the parent’s orientation, this is the relative center of this object.

Local-orientation 3x3 Matrix of Double-Float Numbers

Indicates the local Rotation Matrix used to create the coordinate system of this object.This is the “local” orientation with respect to the parent. Multiplying the parent’sorientation with this matrix will always result in the absolute orientation for this part.

Hidden objects:

Bounding-bbox GDL object of type Box

A box representing the bounding-box.

Local-bbox GDL object of type Box

A box representing the local-box.

Gdl functions:

Axis-vector 3D Vector

Returns the vector pointing in the positive direction of the specified axis of this object’sreference box.

Edge-center 3D Point

Returns the center of the requested edge of this object’s reference box.

Page 118: Genworks GDL: A User's Manual - Genworks International

112 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Face-center 3D Point

Returns the center of the requested face of this object’s reference box.

Face-normal-vector 3D Vector

Returns the vector pointing from this object’s reference box center to its requested face-center.

Face-vertices List of four 3D points

Returns the vertices of the indicated face.

Global-to-local 3D-point

This function returns the point given in global coordinates, into relative local coordinates,based on the orientation and center of the object to which the global-to-local message issent.

In-face? Boolean

Returns non-nil if the given point is in halfspace defined by the plane given a point anddirection.

Line-intersection-points List of 3D points

Returns the points of intersection between given line and the reference box of this object.

Local-to-global 3D-point

This function returns the point given in relative local coordinates, converted into globalcoordinates, based on the orientation and center of the object to which the local-to-globalmessage is sent.

Vertex 3D Point

Returns the center of the requested vertex (corner) of this object’s reference box.

• base-view

Mixins: base-object

Description Generic container object for displaying a scaled transformed view of geometricor text-based objects. Base-view can be used by itself or as a child of a base-drawing

In a GWL application-mixin, you can include an object of this type in the ui-display-list-leaves.

For the PDF output-format, you can also use the cad-output output-function to writethe view as a PDF document.

Since base-view is inherently a 2D object, only the top view (getf *standard-views* :top)makes sense for viewing it.

Input slots (optional):

Annotation-objects List of GDL objects

These objects will be displayed in each view by default, with no scaling or transform(i.e. they are in Drawing space.

Page 119: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 113

(in-package :gdl-user)

(define-object box-with-two-viewed-drawing (base-object)

:objects

((drawing :type ’two-viewed-drawing

:objects-to-draw (list (the box) (the length-dim)))

(length-dim :type ’horizontal-dimension

:hidden? t

:start-point (the box (vertex :rear :top :left))

:end-point (the box (vertex :rear :top :right)))

(box :type ’box

:hidden? t

:length 5 :width 10 :height 15)))

(define-object two-viewed-drawing (base-drawing)

:input-slots (objects-to-draw)

:objects

((main-view :type ’base-view

:projection-vector (getf *standard-views* :trimetric)

:length (half (the length))

:center (translate (the center)

:rear (half (the-child length)))

:objects (the objects-to-draw))

(top-view :type ’base-view

:projection-vector (getf *standard-views* :top)

:length (* 0.30 (the length))

:objects (the objects-to-draw))))

(generate-sample-drawing :objects

(the-object (make-object ’box-with-two-viewed-drawing) drawing top-view))

Figure 11.8: Example Code for base-view

Page 120: Genworks GDL: A User's Manual - Genworks International

114 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

10.0

Figure 11.9: base-view example

Border-box? Boolean

Determines whether a rectangular border box is drawn around the view, with the view’slength and width. Defaults to nil.

Center 3D-point

Center of the view box. Specify this or corner, not both.

Corner 3D-point

Top left (i.e. rear left from top view) of the view box. Specify this or center, not both.

Front-margin Number in Drawing scale (e

g. points). Amount of margin on front and rear of page when view-scale is to becomputed automatically. Defaults to 25.

Immune-objects List of GDL objects

These objects are immune from view scaling and transform computations and so canfreely refer to the view-scale, view-center, and other view information for self-scalingviews. Defaults to NIL.

Left-margin Number in Drawing scale (e

g. points). Amount of margin on left and right of page when view-scale is to becomputed automatically. Defaults to 25.

Object-roots List of GDL objects

The leaves from each of these objects will be displayed in each view by default.

Objects List of GDL objects

These objects will be displayed in each view by default.

Page 121: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 115

Projection-vector 3D Unitized Vector

Direction of camera pointing to model (the object-roots and/or the objects) to createthis view. The view is automatically “twisted”about this vector to result in “up” beingas close as possible to the Z vector, unless this vector is parallel to the Z vector inwhich case “up” is taken to be the Y (rear) vector. This vector is normally taken fromthe *standard-views* built-in GDL parameter. Defaults to (getf *standard-views*

:top), which is the vector [0, 0, 1].

Snap-to 3D Vector

For a top view, this vector specifies the direction that the rear of the box should befacing. Defaults to *nominal-y-vector*.

View-center 3D Point in Model space

Point relative to each object’s center to use as center of the view.

View-scale Number

Ratio of drawing scale (in points) to model scale for this view. Defaults to being auto-computed.

Gdl functions:

Model-point 3D Point

Takes point in view coordinates and returns corresponding point in model coordinates.

View-point 3D Point

Takes point in model coordinates and returns corresponding point in view coordinates.

• bezier-curve

Mixins: base-object

Description GDL currently supports third-degree Bezier curves, which are defined usingfour 3D ıcontrol-points. The Bezier curve always passes through the first and last controlpoints and lies within the convex hull of the control points. At the start point (i.e. thefirst control point), the curve is tangent to the vector pointing from the start point tothe second control point. At the end point (i.e. the last control point), the curve istangent to the vector pointing from the end point to the third control point.

Input slots (required):

Control-points List of 4 3D Points

Specifies the control points for the Bezier curve.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Page 122: Genworks GDL: A User's Manual - Genworks International

116 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object bezier-sample (bezier-curve)

:computed-slots

((control-points (list (make-point 0 0 0)

(make-point 1 1 0)

(make-point 2 1 0)

(make-point 3 0 0))))

:objects

((points-display :type ’points-display

:points (the control-points))))

(generate-sample-drawing :objects (let ((self (make-object ’bezier-sample)))

(list self (the points-display))))

Figure 11.10: Example Code for bezier-curve

Figure 11.11: bezier-curve example

Page 123: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 117

(in-package :gdl-user)

(define-object box-sample (box)

:computed-slots ((display-controls (list :color :blue-neon))

(length 10)

(width (* (the length) +phi+))

(height (* (the width) +phi+))))

(generate-sample-drawing :objects (make-object ’box-sample)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.12: Example Code for box

Gdl functions:

Circle-intersection-2d List of 3D points

Returns points of intersection in the Z plane between this Bezier curve and the circle inthe Z plane with center center and radius radius.

Line-intersection-2d List of 3D points

Returns points of intersection in the Z plane between this Bezier curve and the infiniteline containing point point and direction vector. Use the between? function if youwish to establish whether the point is contained in a particular line segment.

Point 3D Point

Returns the point on this Bezier curve corresponding to the given parameter, whichshould be between 0 and 1.

• box

Mixins: base-object

Description This represents a “visible” base-object – a six-sided box with all the samemessages as base-object, which knows how to output itself in various formats.

Computed slots:

Volume Number

Total volume of the box.

• c-cylinder

Mixins: cylinder

Description Provides a simple way to create a cylinder, by specifying a start point and anend point.

Input slots (required):

Page 124: Genworks GDL: A User's Manual - Genworks International

118 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.13: box example

(in-package :gdl-user)

(define-object c-cylinder-sample (c-cylinder)

:computed-slots

((display-controls (list :color :plum :transparency 0.2))

(start (make-point 0 0 0))

(end (make-point 0 0 10))

(number-of-sections 7)

(radius 3)))

(generate-sample-drawing :objects (make-object ’c-cylinder-sample)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.14: Example Code for c-cylinder

Page 125: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 119

Figure 11.15: c-cylinder example

End 3D Point

Center of the end cap.

Start 3D Point

Center of the start cap.

Computed slots:

Center 3D Point

Center point of the center-line.

Center-line List of two 3D Points

Represents line segment connecting center of end cap to center of start cap.

Length Number

Distance between cap centers.

Orientation 3x3 Orthonormal Rotation Matrix

Resultant orientation given the specified start and end points.

• center-line

Mixins: outline-specialization-mixin, base-object

Description Creates a dashed single centerline or crosshair centerline on a circle.

Input slots (required):

Page 126: Genworks GDL: A User's Manual - Genworks International

120 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object center-line-test (base-object)

:objects

((circle-sample :type ’circle

:display-controls (list :color :green)

:center (make-point 10 10 10 )

:radius 10)

(center-line-sample :type ’center-line

:circle? t

:center (the circle-sample center)

:size (* 2.1 (the circle-sample radius)))))

(generate-sample-drawing

:objects (list

(the-object (make-object ’center-line-test)

circle-sample)

(the-object (make-object ’center-line-test)

center-line-sample))

:projection-direction (getf *standard-views* :top))

Figure 11.16: Example Code for center-line

Figure 11.17: center-line example

Page 127: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 121

Size Number

The length of the centerline.

Input slots (optional):

Circle? Boolean

Determines whether this will be a circle crosshair. Defaults to nil.

Input slots (optional, defaulting):

Gap-length Number

Distance between dashed line segments. Defaults to 0.1.

Long-segment-length Number

Length of longer dashed line segments. Defaults to 1.0.

Short-segment-length Number

Length of shorter dashed line segments. Defaults to 0.25.

Computed slots:

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• circle

Mixins: arc

Description The set of points equidistant from a given point. The distance from the centeris called the radius, and the point is called the center. The start point of the circle is atthe 3 o’clock position, and positive angles are measured anti-clockwise.

Computed slots:

Area Number

The area enclosed by the circle.

Circumference Number

The perimeter of the circle.

End-angle Angle in radians

End angle of the arc. Defaults to twice pi.

Start-angle Angle in radians

Start angle of the arc. Defaults to zero.

Page 128: Genworks GDL: A User's Manual - Genworks International

122 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object circle-sample (circle)

:computed-slots

((radius 10)))

(generate-sample-drawing :objects (make-object ’circle-sample))

Figure 11.18: Example Code for circle

Figure 11.19: circle example

Page 129: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 123

(in-package :gdl-user)

(define-object cone-sample (cone)

:computed-slots

((display-controls (list :color :blue-neon

:transparency 0.5

:shininess 0.8

:specular-color :white))

(length 10) (radius-1 2)(inner-radius-1 1)

(radius-2 5) (number-of-sections 5)

(inner-radius-2 3)))

(generate-sample-drawing :objects (make-object ’cone-sample)

:projection-direction :trimetric)

Figure 11.20: Example Code for cone

• cone

Mixins: cylinder

Description A pyramid with a circular cross section, with its vertex above the center of itsbase. Partial cones and hollow cones are supported.

Input slots (optional):

Inner-radius-1 Number

The radius of the inner hollow part at the top end for a hollow cone.

Inner-radius-2 Number

The radius of the inner hollow part at the bottom end for a hollow cone.

Radius-1 Number

The radius of the top end of the cone.

Radius-2 Number

The radius of the bottom end of the cone.

Computed slots:

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• constrained-arc

Mixins: arc

Page 130: Genworks GDL: A User's Manual - Genworks International

124 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.21: cone example

Description This object is intended to simplify the process of constructing lines usingvarious constraints. Currently supported are 2 through-points or 1 through-point andat-angle. Note the line-constraints must be an evaluatable s-expression as this is notprocessed as a macro

Computed slots:

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

Radius Number

Distance from center to any point on the arc.

• constrained-fillet

Mixins: constrained-arc, vanilla-mixin

Description This object is the same as constrained-arc, but it is only meaningful for arc-constraints which contain two :tangent-to clauses, and it automatically trims the resultto each point of tangency

Page 131: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 125

Computed slots:

End-angle Angle in radians

End angle of the arc. Defaults to twice pi.

Start-angle Angle in radians

Start angle of the arc. Defaults to zero.

• constrained-line

Mixins: line

Description This object is intended to simplify the process of constructing lines usingvarious constraints. Currently supported are 2 through-points or 1 through-point andat-angle. Note the line-constraints must be an evaluatable s-expression as this is notprocessed as a macro

Computed slots:

End 3D Point

The end point of the line, in global coordinates.

Start 3D Point

The start point of the line, in global coordinates.

Gdl functions:

Tangent-point Icad Compat function

• cylinder

Mixins: ifs-output-mixin, arcoid-mixin, base-object

Description An extrusion of circular cross section in which the centers of the circles all lieon a single line (i.e., a right circular cylinder). Partial cylinders and hollow cylinders aresupported.

Input slots (required):

Length Number

Distance from center of start cap to center of end cap.

Radius Number

Radius of the circular cross section of the cylinder.

Input slots (optional):

Bottom-cap? Boolean

Determines whether to include bottom cap in shaded renderings. Defaults to T.

Page 132: Genworks GDL: A User's Manual - Genworks International

126 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object cylinder-sample (cylinder)

:computed-slots

((display-controls (list :color :pink-spicy))

(length 10)

(radius 3)

(number-of-sections 25)))

(generate-sample-drawing :objects (make-object ’cylinder-sample)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.22: Example Code for cylinder

Figure 11.23: cylinder example

Page 133: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 127

Closed? Boolean

Indicates that a partial cylinder (or cone) should have a closed gap.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Inner-radius Number

Radius of the hollow inner portion for a hollow cylinder.

Number-of-sections Integer

Number of vertical sections to be drawn in wireframe rendering mode.

Top-cap? Boolean

Determines whether to include bottom cap in shaded renderings. Defaults to T.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Computed slots:

Direction-vector 3D Vector

Points from the start to the end.

End 3D Point

The center of the end cap.

Hollow? Boolean

Indicates whether there is an inner-radius and thus the cylinder is hollow.

Start 3D Point

The center of the start cap.

• ellipse

Mixins: arcoid-mixin, base-object

Description A curve which is the locus of all points in the plane the sum of whose distancesfrom two fixed points (the foci) is a given positive constant. This is a simplified 3D ellipsewhich will snap to the nearest quarter if you make it a partial ellipse. For a full ellipse,do not specify start-angle or end-angle.

Input slots (required):

Major-axis-length Number

Length of (generally) the longer ellipse axis

Minor-axis-length Number

Length of (generally) the shorter ellipse axis

Input slots (optional):

Page 134: Genworks GDL: A User's Manual - Genworks International

128 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object ellipse-sample (ellipse)

:computed-slots

((minor-axis-length 10)

(major-axis-length (* (the minor-axis-length) +phi+))

(start-angle 0)

(end-angle pi)))

(generate-sample-drawing :objects (make-object ’ellipse-sample))

Figure 11.24: Example Code for ellipse

Figure 11.25: ellipse example

Page 135: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 129

End-angle Angle in Radians

End angle of the ellipse. Defaults to 2pi for full ellipse.

Start-angle Angle in Radians

Start angle of the ellipse. Defaults to 0 for full ellipse.

Computed slots:

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• general-note

Mixins: outline-specialization-mixin, base-object

Description Creates a text note in the graphical view port and in a PDF DXF output file.

Input slots (optional):

Center 3D-point

Center of the text. Specify this or start, not both.

Character-size Number

Specifies the character size in drawing units.

Dxf-font String

This names the DXF font for this general-note. Defaults to (the font).

Dxf-offset Number

The start of text will be offset by this amount for DXF output. Default is 0.

Dxf-size-ratio Number

The scale factor for DXF character size vs PDF character size. Default is 0.8

Dxf-text-x-scale Number in Percentage

Adjusts the character width for DXF output. Defaults to the text-x-scale.

Font String

The font for PDF. Possibilities for built-in PDF fonts are:

– courier

– courier-bold

– courier-boldoblique

– courier-oblique

– helvetica

Page 136: Genworks GDL: A User's Manual - Genworks International

130 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(define-object general-note-test (base-object)

:computed-slots

((blocks-note

(list

"David Brown" "Created by" "ABC 2"

"Jane Smith" "Approved by" "CCD 2"))

(blocks-center

(list ’(-15 5 0) ’(-40 5 0) ’(-55 5 0)

’(-15 15 0) ’(-40 15 0) ’(-55 15 0)))

(blocks-width (list 30 20 10 30 20 10)))

:objects

((title-block :type ’box

:sequence (:size (length (the blocks-center)))

:display-controls (list :color :red)

:center (apply-make-point

(nth (the-child index )

(the blocks-center)))

:length 10

:width (nth (the-child index )

(the blocks-width))

:height 0)

(general-note-sample :type ’general-note

:sequence (:size (length (the blocks-note)))

:center (the (title-block

(the-child index)) center)

:character-size 2.5

:strings (nth (the-child index)

(the blocks-note)))))

(generate-sample-drawing

:objects (list-elements (make-object ’general-note-test))

:projection-direction (getf *standard-views* :top))

Figure 11.26: Example Code for general-note

Page 137: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 131

David BrownCreated byABC 2

Jane SmithApproved byCCD 2

Figure 11.27: general-note example

– helvetica-bold

– helvetica-boldoblique

– helvetica-oblique

– symbol

– times-roman

– times-bold

– times-bolditalic

– times-italic

– zapfdingbats

Defaults to ”Courier”.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Justification Keyword symbol, :left, :right, or :center

Justifies text with its box. Default is :left.

Leading Number

Space between lines of text. Default is 1.2 times the character size.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Outline-shape-type Keyword symbol

Currently can be :bubble, :rectangle, or :none. Default is :none.

Start 3D-point

Start of the text. Specify this or center, not both.

Page 138: Genworks GDL: A User's Manual - Genworks International

132 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Strings List of Strings

The text to be displayed in the note.

Text-x-scale Number in Percentage

Adjusts the character width for PDF output. Defaults to 100.

Underline? Boolean

Determines whether text is underlined.

Width Number

Determines the width of the containing box. Default is the maximum-text-width.

Computed slots:

Maximum-text-width Number

Convienence computation giving the maximum input width required to keep one lineper string

• global-filleted-polygon-projection

Mixins: global-polygon-projection

Description Similar to a global-polygon-projection, but the polygon is filleted as withglobal-filleted-polygon.

Input slots (optional):

Default-radius Number

Specifies a radius to use for all vertices. Radius-list will take precedence over this.

Radius-list List of Numbers

Specifies the radius for each vertex (“corner”) of the filleted-polyline.

• global-filleted-polyline

Mixins: global-filleted-polyline-mixin, vanilla-mixin

Description A sequence of points connected by straight line segments, whose corners arefilleted according to specified radii. Please see global-filleted-polyline-mixin for docu-mentation on the messages.

• global-filleted-polyline-mixin

Mixins: global-polyline-mixin

Description Generates a polyline with the corners filleted according to default radius orthe radius-list.

Input slots (required):

Page 139: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 133

(in-package :gdl-user)

(define-object global-filleted-polygon-projection-sample

(global-filleted-polygon-projection)

:computed-slots

((display-controls (list :color :blue-steel

:transparency 0.3

:shininess 0.7

:spectral-color :white))

(default-radius 5)

(projection-depth 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0)))))

(generate-sample-drawing :objects

(make-object ’global-filleted-polygon-projection-sample)

:projection-direction :trimetric)

Figure 11.28: Example Code for global-filleted-polygon-projection

Page 140: Genworks GDL: A User's Manual - Genworks International

134 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.29: global-filleted-polygon-projection example

(in-package :gdl-user)

(define-object global-filleted-polyline-sample (global-filleted-polyline)

:computed-slots

((default-radius 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0)))))

(generate-sample-drawing :objects (make-object ’global-filleted-polyline-sample))

Figure 11.30: Example Code for global-filleted-polyline

Page 141: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 135

Figure 11.31: global-filleted-polyline example

Vertex-list List of 3D Points

The vertices (“corners”) of the polyline.

Input slots (optional):

Closed? Boolean

Controls whether the filleted-polyline should automatically be closed.

Default-radius Number

Specifies a radius to use for all vertices. Radius-list will take precedence over this.

Radius-list List of Numbers

Specifies the radius for each vertex (“corner”) of the filleted-polyline.

Computed slots:

Straights List of pairs of 3D points

Each pair represents the start and end of each straight segment of the filleted-polyline.

Hidden objects (sequence):

Fillets Sequence of fillets

Each fillet is essentially an arc representing the curved elbow of the filleted-polyline.

• global-polygon-projection

Mixins: base-object, ifs-output-mixin

Page 142: Genworks GDL: A User's Manual - Genworks International

136 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object global-polygon-projection-sample (global-polygon-projection)

:computed-slots

((display-controls (list :color :gold-old :transparency 0.3))

(projection-depth 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0)))))

(generate-sample-drawing :objects (make-object ’global-polygon-projection-sample)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.32: Example Code for global-polygon-projection

Description A polygon “extruded” for a given distance along a single vector. For planarpolygons, the projection vector must not be orthogonal to the normal of the plane of thepolygon. The vertices and projection-vector are given in the global coordinate system,so the local center and orientation do not affect the positioning or orientation of thispart.

Input slots (required):

Projection-depth Number

The resultant distance from the two end faces of the extrusion.

Vertex-list List of 3D points

The vertex list making up the polyline, same as the input for global-polyline.

Input slots (optional):

Offset Keyword symbol

The direction of extrusion with respect to the vertices in vertex-list and the projection-vector:

– :up Indicates to start from current location of vertices and move in the direction ofthe projection-vector.

– :down Indicates to start from current location of vertices and move in the directionopposite the projection-vector.

– :center Indicates to start from current location of vertices and move in the di-rection of the projection-vector ıand opposite the projection-vector, going half theprojection-depth in each direction.

Page 143: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 137

Figure 11.33: global-polygon-projection example

Projection-vector 3D Vector

Indicates the straight path along which the extrusion should occur.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

• global-polyline

Mixins: global-polyline-mixin, vanilla-mixin

Description A sequence of points connected by straight line segments. Please see global-polyline-mixin for documentation on the messages.

• global-polyline-mixin

Mixins: base-object

Description Makes a connected polyline with vertices connected by straight line segments.

Input slots (required):

Vertex-list List of 3D Points

The vertices (“corners”) of the polyline.

Page 144: Genworks GDL: A User's Manual - Genworks International

138 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object global-polyline-sample (global-polyline)

:computed-slots

((vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0)))))

(generate-sample-drawing :objects (make-object ’global-polyline-sample))

Figure 11.34: Example Code for global-polyline

Figure 11.35: global-polyline example

Page 145: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 139

(in-package :gdl-user)

(define-object box-view (base-object)

:objects

((box :type ’box

:length 10 :width (* (the-child length) +phi+)

:height (* (the-child :width) +phi+))

(width-dimension :type ’horizontal-dimension

:character-size (/ (the box length) 20)

:arrowhead-width (/ (the-child character-size) 3)

:start-point (the box (vertex :top :left :rear))

:end-point (the box (vertex :top :right :rear)))))

(generate-sample-drawing :object-roots (make-object ’box-view))

Figure 11.36: Example Code for horizontal-dimension

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Lines List of pairs of 3D points

Each pair represents the start and end of each line segment in the polyline.

• horizontal-dimension

Mixins: linear-dimension, vanilla-mixin

Description Creates a dimension annotation along the horizontal axis.

Input slots (optional):

Base-plane-normal Must be specified in the subclass except for angular

Dim-text-start 3D Point

Determines where the text will start. Defaults to reasonable location for horizontal-dimension.

Computed slots:

Leader-direction-1-vector Must be specified in the subclass except for angular

Leader-direction-2-vector Must be specified in the subclass except for angular

Witness-direction-vector Must be specified in the subclass except for angular

• label

Mixins: outline-specialization-mixin, base-object

Page 146: Genworks GDL: A User's Manual - Genworks International

140 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

16.2

Figure 11.37: horizontal-dimension example

Description Produces a text label for graphical output

Input slots (required):

Leader-path List of 3D Points

List making up leader line, starting from where the arrowhead normally is.

Input slots (optional):

Arrowhead-length Length (from tip to tail) of arrowhead glyph

Defaults to twice the arrowhead-width

Arrowhead-style Keyword Symbol

Style for arrowhead at start of leader-path. Currently supported values are :none,:wedge (the Default), and :double-wedge.

Arrowhead-style-2 Keyword Symbol

Style for arrowhead on end of leader-path. Currently supported values are :none (theDefault), :wedge, and :double-wedge.

Arrowhead-width Width of arrowhead glyph

Defaults to five times the line thickness (2.5)

Character-size Number

Size (glyph height) of the label text, in model units. Defaults to 10.

Dxf-font String

This names the DXF font for this general-note. Defaults to (the font).

Page 147: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 141

(in-package :gdl-user)

(define-object label-sample (base-object)

:objects

((box :type ’box

:length 10 :width (* (the-child length) +phi+)

:height (* (the-child :width) +phi+))

(corner-label :type ’label

:leader-path (let ((start (the box (vertex :top :right :rear))))

(list start

(translate start :right (/ (the box width) 10)

:rear (/ (the box width) 10))

(translate start :right (/ (the box width) 7)

:rear (/ (the box width) 10))))

:text "The Corner"

:character-size (/ (the box width) 15))))

(generate-sample-drawing :object-roots (make-object ’label-sample))

Figure 11.38: Example Code for label

The Corner

Figure 11.39: label example

Page 148: Genworks GDL: A User's Manual - Genworks International

142 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Dxf-offset Number

The start of text will be offset by this amount for DXF output. Default is 2.

Dxf-size-ratio Number

The scale factor for DXF character size vs PDF character size. Default is 0.8

Dxf-text-x-scale Number in Percentage

Adjusts the character width for DXF output. Defaults to the text-x-scale.

Font String naming a standard PDF font

Font for the label text. Defaults to ”Helvetica”

Outline-shape-type Keyword Symbol

Indicates shape of outline enclosing the text. Currently :none, :bubble, :rectangle,and nil are supported. The default is nil

Strings List of strings

Text lines to be displayed as the label. Specify this or text, not both.

Text String

Text to be displayed as the label

Text-gap Number

Amount of space between last point in leader-path and beginning of the label text.Defaults to the width of the letter ”A” in the specified font and character-size.

Text-side Keyword Symbol, either :left or :right

Determines whether the label text sits to the right or the left of the last point in theleader-path. The default is computed based on the direction of the last segment of theleader-path.

View-reference-object GDL object or NIL

View object which will use this dimension. Defaults to NIL.

Computed slots:

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

• leader-line

Mixins: base-object

Description Creates a leader line with arrows on zero, one, or both ends

Input slots (required):

Path-points List of 3D Points

Leader-line is rendered as a polyline going through these points.

Page 149: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 143

Input slots (optional):

Arrowhead-length Number

The length of the arrows. Defaults to (* (the arrowhead-width) 2)

Arrowhead-style Keyword

Controls the style of first arrowhead. Currently only :wedge is supported. Default is:wedge.

Arrowhead-style-2 Keyword

Controls the style and presence of second arrowhead. Currently only :wedge is supported.Default is :none.

Arrowhead-width Number

The width of the arrows. Defaults to (* (the line-thickness) 5).

Break-points List of two points or nil

. The start and end of the break in the leader line to accomodate the dimension-text,in cases where there is overlap.

Computed slots:

Display-controls Plist

May contain keywords and values indicating display characteristics for this object. Thefollowing keywords are recognized currently:

:color color keyword from the *color-table* parameter, or an HTML-style hexidecimalRGB string value, e.g. ”#FFFFFF” for pure white. Defaults to :black.

:line-thickness an integer, defaulting to 1, indicating relative line thickness for wire-frame representations of this object.

:dash-pattern (currently PDF/PNG/JPEG only). This is a list of two or three num-bers which indicate the length, in pixels, of the dashes and blank spaces in a dashedline. The optional third number indicates how far into the line or curve to start thedash pattern.

• line

Mixins: base-object

Description Provides a simple way to create a line, by specifying a start point and an endpoint.

Input slots (required):

End 3D Point

The end point of the line, in global coordinates.

Start 3D Point

The start point of the line, in global coordinates.

Page 150: Genworks GDL: A User's Manual - Genworks International

144 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object line-sample (line)

:computed-slots

((start (make-point -10 -10 0))

(end (make-point 10 10 0))))

(generate-sample-drawing :objects (make-object ’line-sample))

Figure 11.40: Example Code for line

Figure 11.41: line example

Page 151: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 145

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Center 3D Point

The center of the line.

Direction-vector 3D Vector

Points from start to end of the line.

Length Number

The distance from start to end of the line.

• linear-dimension

Mixins: outline-specialization-mixin, base-object

Description Creates a dimension along either the horizontal, vertical, or an arbitray axis.Use horizontal-dimension, vertical-dimension, or parallel-dimension, respec-tively, to achieve these.

Input slots (required):

Base-plane-normal Must be specified in the subclass except for angular

End-point 3D Point

Actual point where the dimension will stop measuring

Leader-direction-1-vector Must be specified in the subclass except for angular

Leader-direction-2-vector Must be specified in the subclass except for angular

Start-point 3D Point

Actual point where the dimension will start measuring

Witness-direction-vector Must be specified in the subclass except for angular

Input slots (optional):

Arrowhead-length Length (from tip to tail) of arrowhead glyph

Defaults to twice the arrowhead-width

Arrowhead-style Keyword Symbol

Style for arrowhead on end of leader-line. Currently supported values are :none,:wedge (the Default), and :double-wedge.

Arrowhead-style-2 Keyword Symbol

Style for arrowhead on end of leader-line. Currently supported values are :none (theDefault), :wedge, and :double-wedge.

Arrowhead-width Width of arrowhead glyph

Defaults to half the character-size.

Page 152: Genworks GDL: A User's Manual - Genworks International

146 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Character-size Number

Size (glyph height) of the label text, in model units. Defaults to 1.

Dim-text String

Determines the text which shows up as the dimension label. Defaults to the dim-value,which is computed specially in each specific dimension type.

Dim-text-bias Keyword symbol, :start, :end, or :center

Indicates where to position the text in the case when

outside-leaders?¯

is non-nil. Defaults to :center

Dim-text-start 3D Point

Determines where the text will start. Defaults to halfway between start-point and end-point.

Dim-text-start-offset 3D Vector (normally only 2D are used)

. The dim-text-start is offset by this vector, in model space. Defaults to #(0.0 0.0 0.0)

Dim-value Number

2D distance relative to the base-plane-normal. Can be over-ridden in the subclass

Dxf-font String

This names the DXF font for this general-note. Defaults to (the font).

Dxf-offset Number

The start of text will be offset by this amount for DXF output. Default is 2.

Dxf-size-ratio Number

The scale factor for DXF character size vs PDF character size. Default is 0.8

Dxf-text-x-scale Number in Percentage

Adjusts the character width for DXF output. Defaults to the text-x-scale.

Flip-leaders? Boolean

Indicates which direction the witness lines should take from the start and end points.The Default is NIL, which indicates :rear (i.e. “up”) for horizontal-dimensions and:right for vertical-dimensions

Font String naming a standard PDF font

Font for the label text. Defaults to ”Helvetica”

Full-leader-line-length Number

Indicates the length of the full leader when outside-leaders? is nil. This defaults tonil, which indicates that the full-leader’s length should be auto-computed based on thegiven start-point and end-point.

Justification Keyword symbol, :left, :right, or :center

. For multi-line dim-text, this justification is applied.

Leader-1? Boolean

Indicates whether the first (or only) leader line should be displayed. The Default is T

Leader-2? Boolean

Indicates whether the second leader line should be displayed. The Default is T

Page 153: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 147

Leader-line-length Number

Indicates the length of the first leader for the case when outside-leaders? is non-NIL

Leader-line-length-2 Number

Indicates the length of the second leader for the case when outside-leaders? is non-NIL

Leader-text-gap Number

Amount of gap between leader lines and dimension text, when the dimension text iswithin the leader. Defaults to half the character-size.

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

Outline-shape-type Keyword symbol

Currently can be :bubble, :rectangle, or :none. Default is :none.

Outside-leaders-length-factor Number

Indicates the default length of the outside-leaders as a multiple of arrowhead-length.Defaults to 3.

Outside-leaders? Boolean

Indicates whether the leader line(s) should be inside or outside the interval between thestart and end points. The default is NIL, which indicates that the leader line(s) shouldbe inside the interval

Text-above-leader? Boolean

Indicates whether the text is to the right or above the leader line, rather than in-linewith it. Default is T.

Text-along-axis? Boolean

Where applicable, determines whether text direction follows leader-line direction

Text-x-scale Number in Percentage

Adjusts the character width for the dimension-text and currently only applies only toPDF output

Underline? GDL

View-reference-object GDL object or NIL

View object which will use this dimension. Defaults to NIL.

Witness-line-2? Boolean

Indicates whether to display a witness line coming off the end-point. Default is T

Witness-line-ext Number

Distance the witness line(s) extend beyond the leader line. Default is 0.3

Witness-line-gap Number

Distance from the start-point and end-point to the start of each witness-line. Defaultis 0.1

Page 154: Genworks GDL: A User's Manual - Genworks International

148 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object parallel-dimension-sample (base-object)

:objects

((box :type ’box

:length 10 :width (* (the-child length) +phi+)

:height (* (the-child :width) +phi+))

(length-dimension :type ’parallel-dimension

:character-size (/ (the box length) 20)

:start-point (the box (vertex :top :left :front))

:end-point (the box (vertex :top :right :rear)))))

(generate-sample-drawing :object-roots (make-object ’parallel-dimension-sample))

Figure 11.42: Example Code for parallel-dimension

Witness-line-length Number

Length of the witness lines (or of the shorter witness line in case they are differentlengths)

Witness-line? Boolean

Indicates whether to display a witness line coming off the start-point. Default is T

• parallel-dimension

Mixins: linear-dimension

Description Creates a dimension annotation along an axis from a start point to an endpoint.

Input slots (optional):

Dim-text-start 3D Point

Determines where the text will start. Defaults to reasonable location for horizontal-dimension.

Computed slots:

Base-plane-normal Must be specified in the subclass except for angular

Leader-direction-1-vector Must be specified in the subclass except for angular

Leader-direction-2-vector Must be specified in the subclass except for angular

Witness-direction-vector Must be specified in the subclass except for angular

Page 155: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 149

19.0

Figure 11.43: parallel-dimension example

• pie-chart

Mixins: base-object

Description Generates a standard Pie Chart with colored filled pie sections.

This object was inspired by the pie-chart in Marc Battyani’s (marc.battyani(at)fractalconcept.com)cl-pdf, with contributions from Carlos Ungil (Carlos.Ungil(at)cern.ch).

Input slots (optional):

Data List of Numbers

The relative size for each pie piece. These will be normalized to percentages. Defaultsto NIL, must be specified as non-NIL to get a result.

Include-legend? Boolean

Determines whether the Legend is included in standard output formats. Defaults to t.

Labels&colors List of lists, each containing a string and a keyword symbol

This list should be the same length as data. These colors and labels will be assigned toeach pie piece and to the legend. Defaults to NIL, must be specified as non-NIL to geta result.

Line-color Keyword symbol naming color from *color-table*

. Color of the outline of the pie. Defaults to :black.

Radius Number

The radius of the pie. Defaults to 0.35 times the width.

Page 156: Genworks GDL: A User's Manual - Genworks International

150 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object pie-sample (pie-chart)

:computed-slots

((data (list 30 70))

(labels&colors ’(("Expenses" :red) ("Revenue" :green)))

(width 200)

(title "Cash Flow")))

(generate-sample-drawing :objects (make-object ’pie-sample))

Figure 11.44: Example Code for pie-chart

Figure 11.45: pie-chart example

Page 157: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 151

(in-package :gdl-user)

(define-object point-sample (base-object)

:objects

((bezier :type ’bezier-curve

:control-points (list (make-point 0 0 0)

(make-point 1 1 0)

(make-point 2 1 0)

(make-point 3 0 0)))

(points-to-show :type ’point

:sequence (:size (length (the bezier control-points)))

:center (nth (the-child :index)

(the bezier control-points))

:radius 0.08

:display-controls (list :color :blue))))

(generate-sample-drawing :object-roots (make-object ’point-sample))

Figure 11.46: Example Code for point

Title String

Title for the chart. Defaults to the empty string.

Title-color Keyword symbol naming color from *color-table*

. Color of title text. Defaults to :black.

Title-font String

Currently this must be a PDF font name. Defaults to ”Helvetica.”

Title-font-size Number

Size in points of title font. Defaults to 12.

• point

Mixins: sphere

Description Visual representation of a point as a small view-independent crosshair. Thismeans the crosshair will always appear in a “top” view regardless of the current viewtransform. The crosshair will not scale along with any zoom state unless the scale?

optional input-slot is non-NIL. The default color for the crosshairs is a light grey (:grey-light-very in the *color-table*).

Input slots (optional):

Crosshair-length Number

Distance from center to end of crosshairs used to show the point. Default value is 3.

Page 158: Genworks GDL: A User's Manual - Genworks International

152 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.47: point example

Radius Number

Distance from center to any point on the sphere.

Scaled? Boolean

Indicates whether the crosshairs drawn to represent the point are scaled along withany zoom factor applied to the display, or are fixed with respect to drawing space. Thedefault is NIL, meaning the crosshairs will remain the same size regardless of zoom state.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

• renderer-mixin

Mixins: vanilla-mixin

Description Object mixed into the base-view to compute required values to provide arendered perspective view, as in VRML.

Input slots (required):

Object-roots List of GDL Objects

Roots of the leaf objects to be displayed in this renderer view.

Objects List of GDL Objects

Leaves of the objects to be displayed in this renderer view.

Page 159: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 153

Input slots (optional):

3d-box List of two 3D points

The left-front-lower and right-rear-upper corners of the axis-aligned bounding box of theobject-roots and objects.

3d-box-center 3D Point

The effective view center for the scene contained in this view object. Defaults to the cen-ter of the bounding sphere of all the objects in the scene, consisting of the object-rootsand the objects.

Bounding-sphere Plist containing keys: :center and :radius

This plist represents the tightest-fitting sphere around all the objects listed in theobject-roots and the objects

Field-of-view-default Number in angular degrees

The maximum angle of the view frustrum for perspective views. Defaults to 0.1 (whichresults in a near parallel projection with virtually no perspective effect).

View-vectors Plist

Keys indicate view vector names (e.g. :trimetric), and values contain the 3D vectors.Defaults to the parameter *standard-views*, but with the key corresponding to current(the view) ordered first in the plist. This list of view-vectors is used to construct thedefault viewpoints.

Viewpoints List of Plists

Each plist contains, based on each entry in the view-vectors, keys:

– :point (camera location, defaults to the 3d-box-center translated along the cor-responding element of view-vectors) by the local camera distance. The cameradistance is computed based on the field-of-view angle and the bounding-sphere

– :orientation (3d matrix indicating camera orientation)

– field-of-view Angle in degrees of the view frustrum (i.e. lens angle of the virtualcamera).

• route-pipe

Mixins: global-filleted-polyline-mixin, outline-specialization-mixin

Description Defines an alternating set of cylinders and torus sections for the elbows

Input slots (required):

Outer-pipe-radius Number

Radius to the outer surface of the piping.

Vertex-list List of 3D Points

Same as for global-filleted-polyline (which is mixed in to this part)

Input slots (optional):

Page 160: Genworks GDL: A User's Manual - Genworks International

154 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object route-pipe-sample (base-object)

:objects

((pipe :type ’route-pipe

:vertex-list (list #(410.36 436.12 664.68)

#(404.21 436.12 734.97)

#(402.22 397.48 757.72)

#(407.24 397.48 801.12)

#(407.24 448.0 837.0)

#(346.76 448.0 837.0))

:default-radius 19

:outer-pipe-radius 7

:inner-pipe-radius nil

:display-controls (list :color :blue-steel

:transparency 0.0

:shininess 0.7

:spectral-color :white))))

(generate-sample-drawing :objects (the-object (make-object ’route-pipe-sample) pipe)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.48: Example Code for route-pipe

Page 161: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 155

Figure 11.49: route-pipe example

Inner-pipe-radius Number

Radius of the inner hollow part of the piping. NIL for a solid pipe.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

Width Number

X-axis dimension of the reference box. Defaults to zero.

• sample-drawing

Mixins: base-drawing, vanilla-mixin

Page 162: Genworks GDL: A User's Manual - Genworks International

156 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object sphere-sample (sphere)

:computed-slots

((radius 150)

(number-of-vertical-sections 10)

(number-of-horizontal-sections 10)

(display-controls (list :color :green-forest-medium))))

(generate-sample-drawing :objects (make-object ’sphere-sample)

:projection-direction :trimetric)

Figure 11.50: Example Code for sphere

Description Defines a simple drawing with a single view for displaying objects or object-roots.

Input slots (optional):

Page-length Number in PDF Points

Front-to-back (or top-to-bottom) length of the paper being represented by this drawing.The default is (* 11 72) points, or 11 inches, corresponding to US standard letter-sizepaper.

Page-width Number in PDF Points

Left-to-right width of the paper being represented by this drawing. The default is (* 8.572) points, or 8.5 inches, corresponding to US standard letter-size paper.

• sphere

Mixins: ifs-output-mixin, arcoid-mixin, base-object

Description The set of points equidistant from a given center point.

Input slots (required):

Radius Number

Distance from center to any point on the sphere.

Input slots (optional):

Page 163: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 157

Figure 11.51: sphere example

End-horizontal-arc Angle in radians

Ending horizontal angle for a partial sphere. Default is twice pi.

End-vertical-arc Angle in radians

Ending vertical angle for a partial sphere. Default is pi/2.

Inner-radius Number

Radius of inner hollow for a hollow sphere. Default is NIL, for a non-hollow sphere.

Number-of-horizontal-sections Number

How many lines of latitude to show on the sphere in some renderings. Default value is4.

Number-of-vertical-sections Number

How many lines of longitude to show on the sphere in some renderings. Default value is4.

Start-horizontal-arc Angle in radians

Starting horizontal angle for a partial sphere. Default is 0.

Start-vertical-arc Angle in radians

Starting vertical angle for a partial sphere. Default is -pi/2.

Computed slots:

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Page 164: Genworks GDL: A User's Manual - Genworks International

158 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object spherical-cap-sample (spherical-cap)

:computed-slots

((base-radius 150)

(cap-thickness 7)

(axis-length (* (the base-radius) +phi+))

(number-of-vertical-sections 10)

(number-of-horizontal-sections 10)

(display-controls (list :color :orchid-medium :transparency 0.5))))

(generate-sample-drawing :objects (make-object ’spherical-cap-sample)

:projection-direction :trimetric)

Figure 11.52: Example Code for spherical-cap

Width Number

X-axis dimension of the reference box. Defaults to zero.

• spherical-cap

Mixins: ifs-output-mixin, arcoid-mixin, base-object

Description The region of a sphere which lies above (or below) a given plane. Althoughthis could be created with a partial sphere using the sphere primitive, the spherical capallows for more convenient construction and positioning since the actual center of thespherical cap is the center of its reference box.

Input slots (required):

Axis-length Number

The distance from the center of the base to the center of the dome.

Base-radius Number

Radius of the base.

Input slots (optional):

Cap-thickness Number

Thickness of the shell for a hollow spherical-cap. Specify this or inner-base-radius, notboth.

Inner-base-radius Number

Radius of base of inner for a hollow spherical-cap. Specify this or cap-thickness, notboth.

Page 165: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 159

Figure 11.53: spherical-cap example

Number-of-horizontal-sections Integer

How many lines of latitude to show on the spherical-cap in some renderings. Defaultvalue is 2.

Number-of-vertical-sections Integer

How many lines of longitude to show on the spherical-cap in some renderings. Defaultvalue is 2.

Computed slots:

End-angle Angle in radians

End angle of the arc. Defaults to twice pi.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Sphere-center 3D Point

Center of the sphere containing the spherical-cap.

Sphere-radius Number

Radius of the sphere containing the spherical-cap.

Start-angle Angle in radians

Start angle of the arc. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Page 166: Genworks GDL: A User's Manual - Genworks International

160 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• text-line

Mixins: base-object

Description Outputs a single line of text for graphical display.

Input slots (optional):

Center 3D-point

Center of the text. Specify this or start, not both.

Start 3D-point

Start of the text. Specify this or center, not both.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Computed slots:

Length Number

Y-axis dimension of the reference box. Defaults to zero.

• torus

Mixins: ifs-output-mixin, arcoid-mixin, base-object

Description A single-holed “ring” torus, also known as an “anchor ring.” This is basicallya circular cylinder “bent” into a donut shape. Partial donuts (“elbows”) are supported.Partial “bent” cylinders are not currently supported.

Input slots (required):

Major-radius Number

Distance from center of donut hole to centerline of the torus.

Minor-radius Number

Radius of the bent cylinder making up the torus.

Input slots (optional):

Draw-centerline-arc? Boolean

Indicates whether the bent cylinder’s centerline arc should be rendered in some render-ings.

End-caps? Boolean

Indicates whether to include end caps for a partial torus in some renderings. Defaultsto T.

Inner-minor-radius Number

Radius of the inner hollow part of the bent cylinder for a hollow torus. Defaults to NILfor a solid cylinder

Page 167: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 161

(in-package :gdl-user)

(define-object torus-sample (torus)

:computed-slots

((major-radius 150)

(minor-radius 42)

(draw-centerline-arc? t)

(number-of-longitudinal-sections 10)

(number-of-transverse-sections 10)

(display-controls (list :color :green-forest-medium)))

:hidden-objects ((view :type ’base-view

:projection-vector (getf *standard-views* :trimetric)

:page-width (* 5 72) :page-length (* 5 72)

:objects (list self))))

(generate-sample-drawing :objects (make-object ’torus-sample)

:projection-direction :trimetric)

Figure 11.54: Example Code for torus

Figure 11.55: torus example

Page 168: Genworks GDL: A User's Manual - Genworks International

162 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Number-of-longitudinal-sections Integer

Indicates the number of arcs to be drawn on along “surface” of the torus in some wire-frame renderings.

Number-of-transverse-sections Integer

Indicates the number of circular cross-sections of the bent cylinder to show in somewireframe renderings.

Input slots (optional, defaulting):

Arc Angle in Radians

Indicates the end angle for the donut. Defaults to twice pi for a full-circle donut.

Computed slots:

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• typeset-block

Mixins: base-object

Description Block of text typeset using cl-typesetting. This object wraps the typeset blockas a standard GDL object, so it can be placed in a view and positioned according tonormal GDL positioning.

You can specify the width, and by default this object will compute its length automat-ically from the typeset content, to fit all the lines of text into the box. Because of thiscomputed behavior of the length, the center of the box will not, in general, be in a knownlocation compared to the start of the text. Because of this it is recommended to use:corner, rather than :center, for positioning a base-view which contains a typeset block.

In the normal case, if you want a single block in a view on a drawing, you should make thebase-view object have the same width and length as the typeset-block. The base-viewshould also probably have :left-margin 0 and :front-margin 0.

Input slots (optional):

Center 3D-point

Center of the text. Specify this or start, not both.

Length Number

The length of the box to contain the compiled content. Defaults is (the length-default),which will exactly fit the compiled content into the specified width. If you override it tobe less than this default, the content will be cropped.

Page 169: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 163

(in-package :gdl-user)

(define-object vertical-dimension-sample (base-object)

:objects

((box :type ’box

:length 10 :width (* (the-child length) +phi+)

:height (* (the-child :width) +phi+))

(length-dimension :type ’vertical-dimension

:character-size (/ (the box length) 20)

:flip-leaders? t

:start-point (the box (vertex :top :left :front))

:end-point (the box (vertex :top :left :rear)))))

(generate-sample-drawing :object-roots (make-object ’vertical-dimension-sample))

Figure 11.56: Example Code for vertical-dimension

Start 3D-point

Start of the text. Specify this or center, not both.

Start-line-index Number

The line number to start

Computed slots:

Length-default Number

The computed length which will exactly fit the content based on (the width).

Lines List of typeset line objects

The list of lines in the nominal block.

• vertical-dimension

Mixins: linear-dimension

Description Creates a dimension annotation along the vertical axis.

Input slots (optional):

Dim-text-start 3D Point

Determines where the text will start. Defaults to reasonable location for horizontal-dimension.

Computed slots:

Page 170: Genworks GDL: A User's Manual - Genworks International

164 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

10.0

Figure 11.57: vertical-dimension example

Base-plane-normal Must be specified in the subclass except for angular

Leader-direction-1-vector Must be specified in the subclass except for angular

Leader-direction-2-vector Must be specified in the subclass except for angular

Witness-direction-vector Must be specified in the subclass except for angular

11.12.2 Function and Macro Definitions

• 3d-distance

(type Number intro The three-dimensional distance from point-1 to point-2. arguments(point-1 3D point point-1 3D point))

• 3d-vector-to-array

(type 3-by-1 Lisp array of double-floats intro Returns a 3-by-1 Lisp array of double-float num-bers built from a 3D-Vector of double-floats. This can be useful for example for multiplyinga GDL 3d-point (which is a 1-d vector) by a 3x3 matrix represented as a 2D Lisp array.arguments (vector 3D-Vector of double-floats (e.g. created with make-vector macro)))

• acosd

(type Number intro Returns the arc cosine of ¡b¿theta¡/b¿, converted into degrees. arguments(theta Number. An angle in radians))

• add-matrices

(type Lisp Array intro Adds two matrices element-by-element. rest (matrics ”Lisp Arrays ofsame dimensions”) )

Page 171: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 165

• add-vectors

(type Vector intro Return a new vector, the result of affine vector addition. arguments (v12D, 3D, or 4D Vector v2 2D, 3D, or 4D Vector))

• alignment

(type 3x3 Orthonormal Rotation Matrix intro Constructs a rotation matrix from the givenaxes and vectors. Up to three pairs of axis and vector can be given. If only one pair is given,then the orthogonal component of its vector with respect to the other two global axes is used.If a second pair is given, then the orthogonal component of its vector with respect to thefirst vector is used. A third pair is only required if a left-handed coordinate system is desired(right-handed is the default). The third vector will always be converted to the cross of the firsttwo, unless it is given as the reverse of this, which will force a left-handed coordinate system.Axes are direction keywords which can be one of: ¡ul¿¡li¿¡tt¿:right¡/tt¿¡/li¿ ¡li¿¡tt¿:left¡/tt¿¡/li¿¡li¿¡tt¿:rear¡/tt¿¡/li¿ ¡li¿¡tt¿:front¡/tt¿¡/li¿ ¡li¿¡tt¿:top¡/tt¿¡/li¿ ¡li¿¡tt¿:bottom¡/tt¿¡/li¿¡/ul¿ Thesecond axis keyword, if given, must be orthogonal to the first, and the third, if given, mustbe orthogonal to the first two. arguments (axis-1 Direction Keyword vector1 3D Vector)&optional (axis-2 Direction Keyword vector2 3D Vector axis-3 Direction Keyword vector33D Vector))

• angle-between-vectors

(type Number intro Returns the angle in radians between ¡b¿vector-1¡/b¿ and ¡b¿vector-2¡/b¿.If no ¡b¿reference-vector¡/b¿ given, the smallest possible angle is returned. If a ¡b¿reference-vector¡/b¿ is given, computes according to the right-hand rule. If ¡b¿-ve¡/b¿ is given, returnsa negative number for angle if it really is negative according to the right-hand rule. arguments(vector-1 3D Vector vector-2 3D Vector) &optional ((reference-vector nil) 3D Vector) &key((epsilon *zero-epsilon*) Number. Determines how small of an angle is considered to be zero.(-ve nil) Boolean))

• angle-between-vectors-d

(type Number intro This function is identical to angle-between-vectors, but returns the an-gle in degrees. Refer to angle-between-vectors for more information. Technical note: the¡b¿more¡/b¿ argument has been introduced to support both angle-between-vectors call con-ventions and the legacy signature: (vector-1 vector-2 &optional reference-vector negative?)Optionally, a deprecation warning is printed when code invokes this legacy pattern.. )

• apply-make-point

(type 2D, 3D, or 4D point intro This function takes a list of two, three, or four numbers ratherthan multiple arguments as with the make-point and make-vector macro. This is equivalentto calling the make-point or make-vector macro on the elements of this list. arguments (listList of 2, 3, or 4 numbers. The coordinates for the point.))

• array-to-3d-vector

(type 3D Vector intro Returns a 3D-Vector of double-floats built from a 3-by-1 Lisp array ofnumbers. arguments (array 3-by-1 Lisp array of numbers))

Page 172: Genworks GDL: A User's Manual - Genworks International

166 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• array-to-list

(type List intro Converts ¡b¿array¡/b¿ to a list. arguments (array Lisp Array of Num-bers) &optional ((decimal-places 2) Integer. Numbers will be rounded to this many decimalplaces.))

• asind

(type Number intro Returns the arc sine of ¡b¿theta¡/b¿, converted into degrees. arguments(theta Number. An angle in radians))

• atand

(type Number intro Returns the arc tangent of ¡b¿theta¡/b¿, converted into degrees. argu-ments (theta Number. An angle in radians))

• coincident-point?

(type Boolean intro Returns non-NIL iff the distance between ¡b¿point-1¡/b¿ and ¡b¿point-2¡/b¿ is less than ¡b¿tolerance¡/b¿. arguments (point-1 3D Point point-2 3D Point) &key((tolerance *zero-epsilon*) Number))

• create-obliqueness

(type 3x3 Orthonormal Rotation Matrix intro Gives the transform required to be appliedto the parent’s orientation to achieve alignment indicated by the arguments. The directionkeywords are the same as those used with the GDL ¡tt¿alignment¡/tt¿ function. arguments(vector-1 3D Vector direction-1 Direction Keyword vector-2 3D Vector direction-2 DirectionKeyword self GDL object inheriting from ¡tt¿base-object¡/tt¿))

• cross-vectors

(type 3D Vector intro Returns the cross product of vector-1 and vector-2. According to thedefinition of cross product, this resultant vector should be orthogonal to both ¡b¿vector-1¡/b¿and ¡b¿vector-2¡/b¿. arguments (vector-1 3D Vector vector-2 3D Vector))

• degree

(type Number intro Converts angle in degrees, minutes, and seconds into radians. arguments(degrees Number) &optional ((minutes 0) Number))

• degrees-to-radians

(type Number intro Converts ¡b¿degrees¡/b¿ to radians. arguments (degrees Number))

• distance-to-line

(type Number intro Returns shortest distance from point to line. )

• dot-vectors

(type Number intro Returns the dot product of vector-1 and vector-2. arguments (vector-12D, 3D, or 4D Vector vector-2 2D, 3D, or 4D Vector))

• equi-space-points

(type List of points intro Returns a list of equally spaced points between start and end. )

Page 173: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 167

• get-u

(type Double-float number intro Returns U component of 2D parameter value. arguments(point 2D point))

• get-v

(type Double-float number intro Returns V component of 2D parameter value. n:arguments(point ”2D point”) )

• get-w

(type Double-float number intro Returns W component of point or vector arguments (quater-nion 4D point, Quaternion, or Axis-Angle style rotation spec))

• get-x

(type Double-float number intro Returns X component of point or vector arguments (point2D, 3D, or 4D point))

• get-y

(type Double-float number intro Returns Y component of point or vector arguments (point2D, 3D, or 4D point))

• get-z

(type Double-float number intro Returns Z component of point or vector arguments (point3D or 4D point))

• inter-circle-sphere

(type 3D Point or NIL intro Returns point of intersection between the circle described by¡b¿circle-center¡/b¿, ¡b¿circle-radius¡/b¿, and ¡b¿circle-plane-normal¡/b¿, and the sphere de-scribed by ¡b¿sphere-center¡/b¿ and ¡b¿sphere-radius¡/b¿. Iff the circle and sphere do notintersect at all, NIL is returned. arguments (circle-center 3D Point circle-radius Numbercircle-plane-normal 3D Vector sphere-center 3D Point sphere-radius Number positive-angle?Boolean. Controls which of two intersection points is returned) &key ((tolerance *zero-epsilon*) Controls how close the entities must come to touching to be considered as intersect-ing.))

• inter-line-plane

(type 3D Point or NIL intro Returns one point of intersection between line described by point¡b¿p-line¡/b¿ and direction-vector ¡b¿u-line¡/b¿, and plane described by ¡b¿p-plane¡/b¿ and¡b¿u-plane¡/b¿. Iff the line and plane do not intersect at all (i.e. they are parallel), NIL isreturned. arguments (p-line 3D Point. Any point on the line. u-line 3D Vector. Directionof the line. p-plane 3D Point. Any point on the plane. u-plane 3D Vector. Normal of theplane.))

• inter-line-sphere

(type 3D Point or NIL intro Returns one point of intersection between line described by point¡b¿p-line¡/b¿ and direction-vector ¡b¿u-line¡/b¿, and sphere described by ¡b¿center¡/b¿ and

Page 174: Genworks GDL: A User's Manual - Genworks International

168 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

¡b¿radius¡/b¿. Iff the line and sphere do not intersect at all, NIL is returned. arguments(p-line 3D Point. Any point on the line. u-line 3D Vector. Direction of the line. center 3DPoint. Center of the sphere. radius Number. The radius of the sphere. side-vector 3D Vector.Controls which of two possible intersection points is returned.))

• length-vector

(type Number intro Return the vector’s magnitude arguments (vector 3D Vector))

• make-point [Macro]

(type 3D Point intro (Internally this is the same as a 3D Vector) Returns a vector of double-floats from up to 4 numbers. )

• make-transform

(type Lisp array intro Builds a matrix from ¡b¿list-of lists¡/b¿. arguments (list-of-lists List oflists of numbers))

• make-vector [Macro]

(type 0D, 1D, 2D, 3D, or 4D Vector intro (Internally this is the same as a Point) Returns avector of double-floats from up to 4 numbers. )

• matrix*vector

(type Lisp array intro Multiplies matrix by column vector of compatible dimension. arguments(matrix Lisp Array of Numbers vector Vector))

• matrix-to-quaternion

(type Quaternion represented as a 4D Vector intro Transforms rotation ¡b¿matrix¡/b¿ intothe corresponding quaternion. arguments (matrix 3x3 Orthonormal Rotation Matrix (as aLisp Array of Numbers)))

• merge-display-controls [Macro]

(type Plist of display controls intro This macro ”merges” the given display controls list withthat coming as a trickle-down slot from the parent. It will replace any common keys and addany new keys. arguments (display-controls Plist. The new display controls to be merged withthe defaults from the parent))

• midpoint

(type 3D Point intro Returns the barycentric average (i.e. midpoint) of ¡b¿point1¡/b¿ and¡b¿point2¡/b¿. arguments (point1 3D Point point2 3D Point))

• multiply-matrices

(type Lisp Array intro Multiplies compatible-size matrices according to normal matrix math.arguments (matrix-1 Lisp Array of Numbers matrix-2 Lisp Array of Numbers))

• orthogonal-component

(type 3D Unit Vector intro Returns the unit vector orthogonal to ¡b¿reference-vector¡/b¿which is as close as possible to ¡b¿vector¡/b¿. arguments (vector 3D Vector reference-vector3D Vector))

Page 175: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 169

• parallel-vectors?

(type Boolean intro Returns non-nil iff ¡b¿vector-1¡/b¿ and ¡b¿vector-2¡/b¿ are pointing inthe same direction or opposite directions. arguments (vector-1 3D Vector vector-2 3D Vector)&key ((tolerance *zero-epsilon*) Number))

• proj-point-on-line

(type 3D-Point intro Drops ¡b¿3d-point¡/b¿ onto line containing ¡b¿line-point¡/b¿ and whosedirection-vector is ¡b¿vector¡/b¿.

arguments (3D-point 3D Point Line-point 3D Point vector 3D Unit Vector))

• projected-vector

(type 3D Vector intro Returns result of projecting ¡b¿vector¡/b¿ onto the plane whose normalis ¡b¿plane-normal¡/b¿. arguments (vector 3D Vector plane-normal 3D Vector))

• pythagorize

(type Number intro Returns the square root of the sum of the squares of ¡i¿numbers¡/i¿.&rest (numbers List of Numbers))

• quaternion-to-matrix

(type 3x3 Orthonormal Rotation Matrix intro Transforms ¡b¿quaternion¡/b¿ into a 3x3 rota-tion matrix. arguments (quaternion Quaternion, represented as a 4D Vector))

• quaternion-to-rotation

(type Euler rotation represented as a 4D Vector intro Transforms ¡b¿quaternion¡/b¿ into aEuler angle rotation consisting of an arbitrary axis and an angle of rotation about that axis.arguments (quaternion Quaternion, represented as a 4D Vector))

• radians-to-degrees

(type Number intro Converts angle in radians to degrees. arguments (radians Number))

• radians-to-grads

(type Number intro Converts angle in radians to grads. arguments (radians Number))

• reverse-vector

(type Vector intro Return the vector pointing in the opposite direction. arguments (vector2D, 3D, or 4D Vector))

• roll [Macro]

(type [macro] Transformation matrix intro In the context of a GDL object definition (i.e. in a¡tt¿define-object¡/tt¿), returns a transformation matrix based on rotation about ¡b¿axis¡/b¿by some ¡b¿angle¡/b¿. ¡b¿Axis¡/b¿ is a keyword symbol, one of: ¡ul¿¡li¿¡tt¿:lateral¡/tt¿¡/li¿¡li¿¡tt¿:longitudinal¡/tt¿¡/li¿ ¡li¿¡tt¿:vertical¡/tt¿¡/li¿¡/ul¿ ¡b¿Angle¡/b¿ is specified in radians.Any number of axis-angle pairs can be specified. arguments (axis Keyword Symbol angleNumber) &rest (other-axes-and-angles Plist made from axis keyword symbols and numbers))

Page 176: Genworks GDL: A User's Manual - Genworks International

170 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• rotate-point

(type 3D Point intro Returns the 3D Point resulting from rotating ¡b¿point¡/b¿ about ¡b¿center¡/b¿in the plane defined by ¡b¿normal¡/b¿. The rotation can specified either by an arc length(¡b¿arc-length¡/b¿) or an angle in radians (¡b¿angle¡/b¿). A second value is returned, whichis the resulting angle of rotation in radians (this is of possible use if ¡b¿arc-length¡/b¿ is usedto specify the rotation). arguments (point 3D Point center 3D Point normal 3D Vector) &key((arc-length nil) Number (angle nil) Number))

• rotate-point-d

(type 3D Point intro Returns the 3D Point resulting from rotating ¡b¿point¡/b¿ about ¡b¿center¡/b¿in the plane defined by ¡b¿normal¡/b¿. The rotation can specified either by an arc length(¡b¿arc-length¡/b¿) or an angle in degrees (¡b¿angle¡/b¿). A second value is returned, whichis the resulting angle of rotation in degrees (this is of possible use if ¡b¿arc-length¡/b¿ is usedto specify the rotation). arguments (point 3D Point center 3D Point normal 3D Vector) &key((arc-length nil) Number (angle nil) Number))

• rotate-vector

(type Number intro Rotates ¡b¿vector¡/b¿ around ¡b¿normal¡/b¿ by an amount of rotationspecified by ¡b¿angle¡/b¿, which is an angle measured in radians. arguments (vector 3D Vectorangle Number normal 3D Vector))

• rotate-vector-d

(type Number intro Rotates ¡b¿vector¡/b¿ around ¡b¿normal¡/b¿ by an amount of rotationspecified by ¡b¿degrees¡/b¿. arguments (vector 3D Vector degrees Number normal 3D Vector))

• rotation

(type 3x3 orthonormal rotation matrix (as a Lisp Array of Numbers) intro . Returns atransformation matrix based on a rotation by ¡b¿angle¡/b¿, specified in radians, about anarbitrary ¡b¿vector¡/b¿. arguments (vector 3D Vector angle Number))

• same-direction-vectors?

(type Boolean intro Returns non-NIL iff ¡b¿vector-1¡/b¿ and ¡b¿vector-2¡/b¿ are pointing inthe same direction. arguments (vector-1 3D Vector vector-2 3D Vector) &key ((tolerance*zero-epsilon*) Number))

• scalar*matrix

(type Lisp Array intro Returns result of multiplying the scalar number by the matrix. argu-ments (scalar Number matrix Lisp Array of Numbers))

• scalar*vector

(type Vector intro Returns result of multiplying the scalar number by the vector arguments(scalar Number vector 2D, 3D, or 4D Vector))

• sort-points-along-vector

(type List of points intro Returns points in order along given vector. )

Page 177: Genworks GDL: A User's Manual - Genworks International

11.12. GEOM-BASE (WIREFRAME GEOMETRY) 171

• subtract-vectors

(type Vector intro Return a new vector, the result of affine vector subtraction. arguments(v1 2D, 3D, or 4D Vector v2 2D, 3D, or 4D Vector))

• transform-and-translate-point

(type 3D-Point intro Returns the product of ¡b¿vector¡/b¿ and ¡b¿transform¡/b¿, translatedby (i.e. added to) ¡i¿trans-vector¡/i¿. arguments (vector 3D Vector transform 3x3 RotationMatrix trans-vector 3D Vector) examples ¡pre¿ (let ((transform (make-transform ’((0.0 0.01.0) (0.0 1.0 0.0) (1.0 0.0 0.0)))) (v (make-vector 1.0 2.0 3.0)) (t-v (make-vector 3.0 0.0 0.0)))(transform-and-translate-point v transform t-v)) —¿ #(6.0 2.0 1.0) ¡/pre¿ )

• transform-numeric-point

(type 3D-Point intro Returns the product of ¡b¿vector¡/b¿ and ¡i¿transform¡/i¿. arguments(vector 3D Vector transform 3x3 Rotation Matrix) examples ¡pre¿ (let ((transform (make-transform ’((0.0 0.0 1.0) (1.0 0.0 0.0) (0.0 1.0 0.0)))) (v (make-vector 1.0 2.0 3.0))) (transform-numeric-point v transform)) —¿ #(2.0 3.0 1.0) ¡/pre¿ )

• translate [Macro]

(type [Macro] 3D Point intro Within the context of a GDL object definition (i.e. a ¡tt¿define-object¡/tt¿), translate ¡b¿origin¡/b¿ by any number of ¡b¿offsets¡/b¿. arguments (origin 3DPoint) &rest (offsets Plist consisting of direction keywords and numbers. A direction keywordcan be one of: ¡ul¿¡li¿¡tt¿:top¡/tt¿ (or ¡tt¿:up¡/tt¿)¡/li¿ ¡li¿¡tt¿:bottom¡/tt¿ (or ¡tt¿:down¡/tt¿)¡/li¿¡li¿¡tt¿:left¡/tt¿¡/li¿ ¡li¿¡tt¿:right¡/tt¿¡/li¿ ¡li¿¡tt¿:front¡/tt¿¡/li¿ ¡li¿¡tt¿:rear¡/tt¿ (or ¡tt¿:back¡/tt¿)¡/li¿¡/ul¿))

• translate-along-vector

(type 3D Point intro Returns a new point which is ¡b¿point¡/b¿ translated along ¡b¿vector¡/b¿by ¡b¿distance¡/b¿ arguments (point 3D Point vector 3D Vector distance Number))

• transpose-matrix

(type Lisp array intro Transposes rows and columns of ¡b¿matrix¡/b¿. arguments (matrixLisp Array))

• unitize-vector

(type Unit Vector intro Returns the normalized unit-length vector corresponding to ¡b¿vector¡/b¿.arguments (vector 3D Vector) &key ((espsilon *zero-epsilon*) Number. How close vectorshould be to 1.0 to be considered unit-length.))

• zero-vector?

(type Boolean intro Returns non-NIL iff the vector has zero length according to CommonLisp ¡tt¿zerop¡/tt¿ function. arguments (vector 3D Vector))

11.12.3 Variables and Constants

• *break-leaders?*

• *gs-graphics-alpha-bits*

Page 178: Genworks GDL: A User's Manual - Genworks International

172 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• *gs-text-alpha-bits*

• *hash-transforms?*

• *zero-vector-checking?*

• +postnet-bits+

11.13 glm

11.14 gwl (Generative Web Language (GWL))

11.14.1 Object Definitions

• application-mixin

Mixins: layout-mixin

Description This mixin generates a default GWL user interface, similar to node-mixin,but you should use application-mixin if this is a leaf-level application (i.e. has nochildren of type node-mixin or application-mixin

• base-ajax-graphics-sheet

Mixins: base-ajax-sheet, base-html-graphics-sheet

Description This mixes together base-ajax-sheet with base-html-graphics-sheet, and addshtml-format output-functions for several of the new formats such as ajax-enabled png/jpegand Raphael vector graphics.

Input slots (optional):

Background-color Array of three numbers between 0 and 1

RGB Color in decimal format. Color to be used for the background of the viewport.Defaults to the :background from the global *colors-default* parameter.

Display-list-object-roots List of GDL objects

The leaves of each of these objects will be included in the geometry display. Defaults tonil.

Display-list-objects List of GDL objects containing geometry

These are the actual objects themselves, not nodes which have children or other de-scendants that you want to display. If you want to display the leaves of certain nodes,include the objects for those nodes in the display-list-object-roots, not here. Defaults tonil.

Field-of-view-default Number in angular degrees

The maximum angle of the view frustrum for perspective views. Defaults to 45 which isnatural human eye field of view.

Page 179: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 173

Image-format Keyword symbol

Determines the default image format. Defaults to the currently selected value of theimage-format-selector, which itself defaults to :raphael.

Image-format-default Keyword symbol, one of the keys from (the image-format-plist)

. Default for the image-format-selector. Defaults to :png.

Image-format-plist Plist of keys and strings

The default formats for graphics display. Defaults to:

(list :png "PNG image"

:jpeg "jpeg image"

:raphael "SVG/VML")

Immune-objects List of GDL objects

These objects are not used in computing the scale or centering for the display list.Defaults to nil.

Include-view-controls? Boolean

Indicates whether standard view-controls panel should be included with the graphics.

Inner-html String

This can be used with (str .) [in cl-who] or (:princ .) [in htmlGen] to output thissection of the page, without the wrapping :div tag [so if you use this, your code wouldbe responsible for wrapping the :div tag with :id (the dom-id).]

Projection-vector 3D vector

This is the normal vector of the view plane onto which to project the 3D objects. De-faults to (getf *standard-views* (the view-selector value)), and (the view-selector value)defaults to :top.

Use-raphael-graf? Boolean

Include raphael graphing library in the page header? Default nil.

Use-raphael? Boolean

Include raphael javascript library in the page header? Default nil.

View-direction-default Default view initially in the view-selector which is automaticallyincluded in the view-controls.

Viewport-border-default Number

Thickness of default border around graphics viewport. Default is 1.

Computed slots (settable):

Dropped-height-width Plist with :width and :height

The dimensions of the bounding-box of the dragged and/or dropped element.

Dropped-object List representing GDL root-path

This is the root path of the dragged and/or dropped object. This is not tested to see ifit is part of the same object tree as current self.

Page 180: Genworks GDL: A User's Manual - Genworks International

174 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Dropped-x-y 3D point

This is the upper-right corner of the bounding box of the dragged and/or droppedelement.

Js-to-eval String of valid Javascript

This Javascript will be send with the Ajax response, and evaluated after the innerHTMLfor this section has been replaced.

Computed slots:

Graphics String of valid HTML

This can be used to include the geometry, in the format currently selected by the image-format-selector. If the include-view-controls? is non-nil, the view-controls will be ap-pended at the bottom of the graphics inside a table.

Raster-graphics String of valid HTML

This can be used to include the PNG or JPG raster-graphics of the geometry.

Vector-graphics String of valid HTML

This can be used to include the SVG or VML vector-graphics of the geometry.

View-controls String of valid HTML

This includes the image-format-selector, the reset-zoom-button, and the view-selector,in a simple table layout. You can override this to make the view-controls appear anyway you want and include different and/or additional form-controls.

Web3d-graphics String of valid HTML

This can be used to include the VRML or X3D graphics of the geometry.

X3dom-graphics String of valid HTML

This can be used to include the x3dom tag content for the geometry.

Hidden objects:

Image-format-selector Object of type menu-form-control

Its value slot can be used to determine the format of image displayed.

View-object GDL web-drawing object

This must be overridden in the specialized class.

Gdl functions:

Write-embedded-x3dom-world Void

Writes an embedded X3D tag with content for the view-object child of this object.The view-object child should exist and be of type web-drawing.

• base-ajax-sheet

Mixins: base-html-sheet

Page 181: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 175

Description (Note: this documentation will be moved to the specific docs for the html-format/base-ajax-sheet lens, when we have lens documentation working properly)

Produces a standard main-sheet for html-format which includes the standard GDLJavascript to enable code produced with gdl-ajax-call to work, and optionally to in-clude the standard JQuery library.

If you want to define your own main-sheet, then there is no use for base-ajax-sheet,you can just use base-html-sheet. But then you have to include any needed Javascriptyourself, e.g. for gdl-ajax-call support or jQuery.

The html-format lens for base-ajax-sheet also defines a user hook function, main-sheet-body, which produces a ”No Body has been defined” message by default, but which youcan fill in your own specific lens to do something useful for the body.

Input slots (optional):

Body-class String or nil

Names the value of class attribute for the body tag. Default is nil.

Body-onload String of Javascript or nil

This Javascript will go into the :onload event of the body. Default is nil.

Body-onpageshow String of Javascript or nil

This Javascript will go into the :onpageshow event of the body. Default is nil.

Doctype-string String or nil

Contains the string for the doctype at the top of the document. Default is the standarddoctype for HTML5 and later.

Main-sheet-body String of HTML

The main body of the page. This can be specified as input or overridden in subclass,otherwise it defaults to the content produced by the :output-function of the same namein the applicable lens for html-format.

Respondent GDL Object

Object to respond to the form submission. Defaults to self.

Title String

The title of the web page. Defaults to ”Genworks GDL -” .followed by the strings-for-display.

Input slots (optional, settable):

Additional-header-content String of valid HTML

Additional tag content to go into the page header, if you use the default main-sheetmessage and just fill in your own main-sheet-body, as is the intended use of the base-ajax-sheet primitive.

Additional-header-js-content valid javascript

This javascript is added to the head of the page, just before the body.

Page 182: Genworks GDL: A User's Manual - Genworks International

176 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(gwl:define-package :ajax-test (:export #:assembly))

(in-package :ajax-test)

(define-object assembly (base-ajax-sheet)

:objects

((inputs-section :type ’inputs-section)

(outputs-section :type ’outputs-section

:box (the viewport box)

:color (the inputs-section color))

(viewport :type ’viewport

:box-color (the inputs-section color))))

(define-lens (html-format assembly)()

:output-functions

((main-sheet-body

()

(with-cl-who ()

(:table

(:tr

(:td (str (the inputs-section main-div)))

(:td (str (the outputs-section main-div)))

(:td (str (the viewport main-div)))))))))

(define-object inputs-section (sheet-section)

:computed-slots ((color (the menu-control value)))

:objects

((menu-control :type ’menu-form-control

:choice-list (list :red :green :blue)

:default :red

:onchange (the (gdl-ajax-call

:form-controls (list (the-child)))))

(little-grid :type ’grid-form-control

:form-control-types ’(text-form-control

text-form-control

button-form-control)

:form-control-attributes ’((:ajax-submit-on-change? t)

(:ajax-submit-on-change? t))

:form-control-inputs

(mapcar #’(lambda(row)

(list nil nil

(list :onclick

(the (gdl-ajax-call

:function-key :do-something!

:arguments

(list (the-object row index)))))))

(list-elements (the-child rows)))

:default ’((:color :number :press-me)

(:red 42 "OK")

(:blue 50 "OK"))))

:computed-slots

((inner-html (with-cl-who-string ()

(str (the little-grid form-control-string))

(str (the menu-control html-string)))))

:functions

((do-something! (index)

(format t "Processing row ~a...~%" index))))

(define-object outputs-section (sheet-section)

:input-slots (color box)

:computed-slots

((inner-html (with-cl-who-string ()

(:p "The box volume is: " (fmt "~a" (the box volume)))

(:p "The box color is: "

((:span :style (format nil "color: ~a" (the color)))

(str (the color))))))))

(define-object viewport (base-ajax-graphics-sheet)

:input-slots (box-color)

:computed-slots ((length 300)

(width 300)

(display-list-objects (list (the box)))

(projection-vector (getf *standard-views*

(the view-selector value)))

(inner-html

(with-cl-who-string ()

(str (the view-selector html-string))

(str (the reset-zoom-button form-control-string))

(str (the raster-graphics)))))

:objects ((box :type ’box

:length 20 :width 25 :height 30

:display-controls (list :color (the box-color)))))

(publish-gwl-app "/ajax-test" "ajax-test:assembly")

Figure 11.58: Example Code for gwl:base-ajax-sheet

Page 183: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 177

Ui-specific-layout-js Absolute URI in the browser

. This is additional JavaScript that needs to be loaded in order to initiate the layout ofa user interface. Defaults to nil.

Use-jquery? Boolean

Include jquery javascript libraries in the page header? Default nil.

Computed slots:

Development-links String of HTML

Provides the developer control links for current sheet.

Gdl functions:

Custom-snap-restore! Void

This is a hook function which applications can use to restore automatically from a savedsnapshot file.

• base-form-control

Mixins: skeleton-form-control, vanilla-mixin

Author Dave Cooper, Genworks

Description This object can be used to represent a single HTML form control. It capturesthe initial default value, some display information such as the label, and all the standardHTML tag attributes for the tag e.g. INPUT, SELECT, TEXTAREA. GWL will processthe data types according to specific rules, and validate the typed value according to otherdefault rules. A custom validation-function can also be provided by user code.

Sequences of these objects (with :size, :indices, :matrix, and :radial) are supported.

This facility and its documentation is expected to undergo significant and frequent up-grades in the remainder of GDL 1573 and upcoming 1575.

Current to-do list:

1. Currently this works with normal HTTP form submission and full page reloading.We intend to make it work with AJAX and surgical page update as well.

2. We intend to provide inputs for all the standard tag attributes for the accompanyingLABEL tag for the form control.

3. Additional form control elements to be included, to cover all types of form elementsspecified in current HTML standard fromhttp://www.w3.org/TR/html401/interact/forms.html#h-17.2.1

– button-form-control: submit buttons, reset buttons, push buttons.

– checkbox-form-control: checkboxes, radio buttons (multiple of these must beable to have same name)

– menu-form-control: select, along with optgroup and option.

– text-form-control: single-line text input (including masked passwords) and multi-line (TEXTAREA) text input.

Page 184: Genworks GDL: A User's Manual - Genworks International

178 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

– file-form-control: file select for submittal with a form.

– hidden-form-control: input of type hidden.

– object-form-control: (not sure how this is supposed to work yet).

Also, we have to study and clarify the issue of under what conditions values can possiblytake on nil values, and what constitutes a required field as opposed to a non-validatedfield, and whether a blank string on a text input should be represented as a nil value oras an empty string.

Note that checkbox-form-control and menu-form-control currently get automatically in-cluded in the possible-nils.

Input slots (optional):

Accept String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Accesskey String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Ajax-submit-on-change? Boolean

If set to non-nil, this field’s value will be sent to server upon change. Default is nil.

Ajax-submit-on-enter? Boolean

If set to non-nil, this field’s value will be sent to server upon enter. Default is nil.

Align String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Allow-invalid-type? Boolean

If non-nil, then values which fail the type test will still be allowed to be the value.Default is nil.

Allow-invalid? Boolean

If non-nil, then values which fail the type or validation test will still be allowed to bethe value. Default is t.

Allow-nil? Boolean

Regardless of :domain, if this is non-nil, nil values will be accepted. Defaults to t if (thedefault) is nil, otherwise defaults to nil.

Alt String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Append-error-string? Boolean

Determines whether a default error string is appended to string ouput-function for html-format (and therefore html-string computed-slot as well). Defaults to t.

Default Lisp value of a type compatible with (the domain)

This is the initial default value for the control. This must be specified by user code, oran error will result.

Disabled? Boolean

Maps to HTML form control attribute of the same name. Default is nil.

Page 185: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 179

(in-package :gwl-user)

(define-object test-form (base-html-sheet)

:objects

((username :type ’text-form-control

:size 35

:maxlength 30

:allow-nil? t

:default "Ron Paul")

(age :type ’text-form-control

:size 5

:validation-function #’(lambda(input) (or (null input) (> 80 input 70)))

:domain :number

;;:default 72

:default nil )

(bio :type ’text-form-control

:rows 8

:size 120

:default "

Congressman Ron Paul is the leading advocate for freedom in our nation’s capital.

As a member of the U.S. House of Representatives, Dr. Paul tirelessly works for

limited constitutional government, low taxes, free markets, and a return to sound

monetary policies. He is known among his congressional colleagues and his constituents

for his consistent voting record. Dr. Paul never votes for legislation unless the

proposed measure is expressly authorized by the Constitution. In the words of former

Treasury Secretary William Simon, Dr. Paul is the one exception to the Gang of 535 on

Capitol Hill.")

(issues :type ’menu-form-control

:choice-list (list "Taxes" "Health Care" "Foreign Policy")

:default "Taxes"

:multiple? t)

(color :type ’menu-form-control

:size 7

:choice-plist (list :red "red"

:green "green"

:blue "blue"

:magenta "magenta"

:cyan "cyan"

:yellow "yellow"

:orange "orange")

:validation-function #’(lambda(color)

(if (intersection (ensure-list color)

(list :yellow :magenta))

(list :error :disallowed-color-choice)

t))

;;:append-error-string? nil

:multiple? t

:default :red

;;:onchange "alert(’hey now’);"

)

(early-riser? :type ’checkbox-form-control

:default nil)

(favorite-links :type ’text-form-control

:sequence (:size 3)

:size 70

:default "http://")))

(define-lens (html-format test-form)()

:output-functions

((main-sheet

()

(with-html-output (*html-stream* nil :indent t)

(:html (:head (:title "Test Form"))

(:body (:h2 (:center "Test Form"))

(the write-development-links)

(with-html-form (:cl-who? t)

(:p (str (the username html-string)))

(:p "(internal value is: " (fmt "~s" (the username value)) ")")

(:p (str (the age html-string)))

(:p "(internal value is: " (fmt "~s" (the age value)) ")")

(:p (str (the bio html-string)))

(:p (:table

(:tr (:td (str (the issues html-string))))

(:tr (:td (str (the color html-string))))))

(:p (str (the early-riser? html-string)))

(dolist (link (list-elements (the favorite-links)))

(htm (str (the-object link html-string))))

(:p ((:input :type :submit :value " OK "))))))))))

(publish :path "/fe"

:function #’(lambda(req ent)

(gwl-make-object req ent "gwl-user::test-form")))

Figure 11.59: Example Code for gwl:base-form-control

Page 186: Genworks GDL: A User's Manual - Genworks International

180 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Domain Keyword symbol, one of :number, :keyword, :list-of-strings, :list-of-anything, or:string

. This specifies the expected and acceptable type for the submitted form value. Ifpossible, the submitted value will be coerced into the specified type. The default isbased upon the Lisp type of (the default) provided as input to this object. If the defaultis nil, the domain will default to :string

Ismap? Boolean

Maps to HTML form control attribute of the same name. Default is nil.

Label-position Keyword symbol or nil

Specifies where the label tag goes, if any. Can be :table-td (label goes in a td before theform control), :table-td-append (label goes in a td after the form control),

Lang String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Maxlength Number or nil

Maps to HTML form control attribute of the same name. Default is nil.

Nullify-empty-string? Boolean

Regardless of :domain, if this is non-nil, empty strings will convert to nil. Defaults to(the allow-nil?)

Onblur String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onchange String or nil

Maps to HTML form control attribute of the same name. Default is nil, unless ajax-submit-on-change? is non-nil, in which case it calls ajax to set current form value.

Onclick String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Ondblclick String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onenter String or nil

Maps to HTML form control attribute of the same name. Default is nil, unless ajax-submit-on-enter? is non-nil, in which case it calls ajax to set current form value.

Onfocus String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onkeydown String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onkeypress String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onkeyup String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Page 187: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 181

Onmousedown String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onmousemove String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onmouseout String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onmouseover String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onmouseup String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Onselect String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Placeholder String

Text to place in the field by default, overwritten as soon as the field is selected. Worksonly in HTML5. Default is nil.

Preset? Boolean

This switch determines whether this form-control should be preset before the final set-ting, in order to allow any interdependencies to be detected for validation or detectingchanged values. Default is nil.

Prompt String

The prompt used in the label.

Readonly? Boolean

Maps to HTML form control attribute of the same name. Default is nil.

Size Number or nil

Maps to HTML form control attribute of the same name. Default is nil.

Src String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Style String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Tabindex Integer or nil

Maps to HTML form control attribute of the same name. Default is nil.

Title String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Usemap String or nil

Maps to HTML form control attribute of the same name. Default is nil.

Validation-function Function of one argument

The argument will be the submitted form value converted to the proper type. The returnvalue from this function can be nil, any non-nil value, or a plist with keys :validated-valueand :error. The following behavior applies:

Page 188: Genworks GDL: A User's Manual - Genworks International

182 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

– If the function returns nil, error is set to :unspecified-validation-fail.

– If the function returns a plist with keys :validated-value and :error, and if :error isnon-nil, it means the value is not acceptable, the form-controls error message is setto this error (usually a keyword symbol), and the error string will be appended tothe html-string by default.

– If the function returns any other value, then the properly typed submitted formvalue is considered valid and is used.

In the case of an error, the form-control’s failed-value message is set to the properlytyped submitted form value. If allow-invalid? is non-nil, then the form-control’s valuemessage is also set to this value (i.e. the invalid value is still accepted, even though anon-nil error is present). Default is (list :validated-value value :error nil).

Computed slots (settable):

Error String or error object

This will be set to a validation error if any, and cleared when the error is gone.

Failed-value Lisp value

The value which was attempted to be set but failed validation.

Value Lisp value

The current value of this form control.

Gdl functions:

Restore-defaults! Void

Restores the default for the value, the failed-value, and the error.

• base-html-graphics-sheet

Mixins: base-html-sheet, geometry-view-mixin, base-object

Description This mixin allows a part to be displayed as a web page in GWL, and tocontain one graphics area. It requires the geom-base module to be loaded. This willprobably be extended to allow more than one graphics area. This mixin inherits frombase-html-sheet, so just like with base-html-sheet you can prepare the output withthe write-html-sheet function in a the object which mixes this in, or in a main-sheet

output-function in an html-format view of the object.

Input slots (optional):

Standard-views Plist of keywords and 3D vectors

. Indicates the views to show in the graphics controls.

Use-bsplines? Boolean

Determines whether to use native bspline data in the vrml

Input slots (optional, settable):

Page 189: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 183

Digitation-mode Keyword symbol, one of :zoom-and-center, :report-point, or :measure-distance

.

– If :zoom-and-center, sets the user-center and user-scale accordingly when graphicsarea is clicked.

– If :report-point, the slot digitized-point is set with the x y value.

– If measure-distance, the slot :digitized-distance is set with the resultant dis-tance.

Default is :zoom-and-center

Image-format Keyword symbol

Determines the default image format. Defaults to :png

View Keyword symbol

Determines the default view from the standard-views. Defaults to :trimetric.

Zoom-factor Number

The factor used for zooming in or out.

Zoom-mode Keyword symbol, one of :in, :out, or :none, or nil

If :in, then clicks in the graphics area will increase the zoom factor by (the zoom-factor).If :out, then clicks will decrease the factor by that amount. If :none or nil, then clickswill have no effect.

Gdl functions:

Background-color Keyword symbol, string, list, or vector

Default background for the graphics viewport. Can be specified as a name (keywordor string) in *color-table*, an html-style hex string (starting with #), or a decimalRGB triplet in a list or vector. The default comes from the :background entry in*colors-default*.

Foreground-color Keyword symbol, string, list, or vector

Default foreground for the graphics viewport. Can be specified as a name (keywordor string) in *color-table*, an html-style hex string (starting with #), or a decimalRGB triplet in a list or vector. The default comes from the :foreground entry in*colors-default*.

Report-point Void

Process the points selected by digitizing in the graphics. You can override this functionto do your own processing. By default, it prints the information to the console.

Write-embedded-vrml-world Void

Writes an EMBED tag and publishes a VRML world for the view-object child of thisobject. The view-object child should exist and be of type web-drawing.

Write-embedded-x3d-world Void

Writes an OBJECT tag and publishes an X3D world for the view-object child of thisobject. The view-object child should exist and be of type web-drawing.

Page 190: Genworks GDL: A User's Manual - Genworks International

184 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Write-geometry Void

Writes an image tag and publishes an image for the view-object child of this object.The view-object child should exist and be of type web-drawing. For objects of typegwl:application-mixin or gwl:node-mixin, this is done automatically. For the timebeing, we recommend that you use gwl:application-mixin or gwl:node-mixin if youwant to display geometric parts in a GWL application.

• base-html-sheet

Mixins: sheet-section, vanilla-mixin

Description This mixin allows a part to be displayed as a web page in GWL. The mainoutput can be specified either in a write-html-sheet function in the object which mixesthis in, or in a main-sheet output-function in an html-format view of the object.

Input slots (optional):

After-present! Void

This is an empty function by default, but can be overridden in the respondent of a form,to do some processing after the respondent’s write-html-sheet function runs to presentthe object.

After-set! Void

This is an empty function by default, but can be overridden in the requestor of a form,to do some processing after the requestor’s form values are set into the specified bashee.

Before-present! Void

This is an empty function by default, but can be overridden in the respondent of aform, to do some processing before the respondent’s write-html-sheet function runsto present the object. This can be useful especially for objects which are subclasses ofhigher-level mixins such as application-mixin and node-mixin, where you do nothave direct access to the write-html-sheet function and typically only define themodel-inputs function. It is not always reliable to do processing in the model-inputs

function, since some slots which depend on your intended modifications may alreadyhave been evaluated by the time the model-inputs function runs.

Before-response! Void

This is an empty function by default, but can be overridden in a user specialization ofbase-html-sheet, to do some processing before the header-plist is evaluated and beforethe HTTP response is actually initiated.

Before-set! Void

This is an empty function by default, but can be overridden in the requestor of a form, todo some processing before the requestor’s form values are set into the specified bashee.

Check-sanity? Boolean

Determines whether a a sanity check is done (with the check-sanity function) beforepresenting the response page if this page is a respondent. Default is NIL.

Page 191: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 185

Process-cookies! Void

This is an empty function by default, but can be overridden in a user specialization ofbase-html-sheet, to do some processing before the header-plist is evaluated and beforethe HTTP response is actually initiated, but after the cookies-received have been set.

Return-object GDL object

Default object to which control will return with the write-back-link method

Target String

Name of a browser frame or window to display this page. Default of NIL indicates touse the same window.

Transitory-slots List of keyword symbols

Messages corresponding to form fields which should not be retained against Updates tothe model (e.g. calls to the update! function or hitting the Update button or link in thebrowser in development mode). Defaults to NIL (the empty list).

Input slots (optional, defaulting):

Respondent GDL Object

Object to respond to the form submission. Defaults to self.

Computed slots (settable):

Query-plist Plist

Contains submitted form field names and values for which no corresponding settablecomputed-slots exist. Where corresponding settable computed-slots exist, their valuesare set from the submitted form fields automatically.

Computed slots:

Header-plist Plist

Extra http headers to be published with the URI for this page.

Url String

The web address in the current session which points at this page. Published on demand.

Gdl functions:

Check-sanity NIL or error object

This function checks the ”sanity” of this object. By default, it checks that following theobject’s root-path from the root resolves to this object. If the act of following the root-path throws an error, this error will be returned. Otherwise, if the result of followingthe root-path does not match the identity of this object, an error is thrown indicatingthis. Otherwise, NIL is returned and no error is thrown. You can override this functionto do what you wish. It should return NIL if the object is found to be ”sane” and anthrow an error otherwise. If check-sanity? is set to T in this object, this function willbe invoked automatically within an ignore-errors by the function handling the GWL”/answer” form action URI when this object is a respondent, before the main-sheet ispresented.

Page 192: Genworks GDL: A User's Manual - Genworks International

186 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Restore-form-controls! Void

Calls restore-defaults! on all the form-controls in this sheet.

Sanity-error Void

Emits a page explaining the sanity error. This will be invoked instead of the write-main-sheet if check-sanity? is set to T and the check-sanity throws an error. You may overridethis function to do what you wish. By default a minimal error message is displayed anda link to the root object is presented.

Select-choices Void

Writes an HTML Select field with Options.

Write-child-links Void

Creates a default unordered list with links to each child part of self. The text of thelinks will come from each child’s strings-for-display.

Write-development-links Void

Writes links for access to the standard developer views of the object, currently consistingof an update (Refresh!) link, a Break link, and a ta2 link.

Write-html-sheet Void

This GDL function should be redefined to generate the HTML page corresponding tothis object. It can be specified here, or as the main-sheet output-function in an html-format lens for this object’s type. This write-html-sheet function, if defined, willoverride any main-sheet function defined in the lens. Typically a write-html-sheet

function would look as follows:

Write-self-link Void

Emits a hyperlink pointing to self. Note that if you need extra customization on thedisplay-string (e.g. to include an image tag or other arbitrary markup), use with-output-to-string in conjunction with the html-stream macro.

Write-standard-footer Void

Writes some standard footer information. Defaults to writing Genworks and Franz copy-right and product links. Note that VAR agreements often require that you include a“powered by” link to the vendor on public web pages.

• checkbox-form-control

Mixins: base-form-control, vanilla-mixin

Author Dave Cooper, Genworks

Description This represents a INPUT of TYPE CHECKBOX

Input slots (optional):

Domain Keyword symbol

The domain defaults to :boolean for the checkbox-form-control. However, this can beoverridden in user code if the checkbox is supposed to return a meaningful value otherthan nil or t (e.g. for a group of checkboxes with the same name, where each can returna different value).

Page 193: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 187

Possible-nil? Boolean

Indicates whether this should be included in possible-nils. Defaults to t.

• color-map

Mixins: base-html-sheet

Description Shows a list of the default colors. This is published as the URI ”/color-map”of the running GWL webserver.

Gdl functions:

Write-html-sheet Void

This GDL function should be redefined to generate the HTML page corresponding tothis object. It can be specified here, or as the main-sheet output-function in an html-format lens for this object’s type. This write-html-sheet function, if defined, willoverride any main-sheet function defined in the lens. Typically a write-html-sheet

function would look as follows:

• geometry-view-mixin

Mixins: vanilla-mixin

Description Internal mixin for use inside e.g. base-html-graphics-sheet.

Input slots (optional):

Length Number

Length (”height” of screen window) of the graphics viewport. Default is 300.

View-object GDL web-drawing object

This must be overridden in the specialized class.

Width Number

Width of the graphics viewport. Default is 300.

• grid-form-control

Mixins: skeleton-form-control, vanilla-mixin

Description Beginnings of spread-sheet-like grid control.

To do: Add row button, sort by column values, save & restore snapshot. Easy way foruser to customize layout and markup.

Allow for all types of form-control for each column.

Input slots (optional):

Default List of lists

These values become the default row and column values for the grid.

Page 194: Genworks GDL: A User's Manual - Genworks International

188 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Form-control-attributes List of plists

Each plist contains the desired form-control inputs for the respective column in the table.

Form-control-inputs List of lists plists

Each list corresponds to one row and contains plists desired form-control inputs for therespective column in the table.

Form-control-types List of symbols naming GDL object types

This must be the same length as a row of the table. The corresponding form-element inthe grid will be of the specified type. Default is nil, which means all the form-controlswill be of type ’text-form-control.

Include-delete-buttons? Boolean

Should each row have a delete button? Default is nil.

Row-labels List of strings

One for each row.

Computed slots:

Form-controls List of GDL objects

All the children or hidden-children of type base-form-control.

• gwl-rule-object

Mixins: base-html-graphics-sheet, base-rule-object

Description Used to display a rule as a GWL web page. Mixes together base-html-sheetand base-rule-object.

• layout-mixin

Mixins: base-html-graphics-sheet

Description This is mixed into both node-mixin and application-mixin. It containsthe common messages for nodes in a GWL application tree. For any node-mixin

or application-mixin, you may override the default (empty) model-inputs output-function of the corresponding html-format view to make specific model-inputs for thatnode.

Input slots (optional):

Available-image-formats List of keyword symbols

Determines which formats are available in the Preferences. Defaults to :png, :jpeg, and:vrml.

Body-bgcolor Keyword symbol

Color keyword from *color-table* for the body background. Defaults to :blue-sky.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Page 195: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 189

Image-format Keyword symbol

Determines the default image format. Defaults to :png

Inputs-bgcolor Keyword symbol

Color keyword from *color-table* for the model-inputs area background. Defaults to:aquamarine.

Inputs-title String

Title for the model-inputs section. Defaults to ”Model Inputs”.

Length Number

Length (”height” of screen window) of the graphics viewport. Default is 300.

Multipart-form? Boolean

Determines whether the embedded form will support multipart MIME parts. Defaultsto NIL.

Other-rules List of GDL objects of type base-rule-object or (preferably) gwl-base-rule-object

. Links to these will be displayed in the other-rules section. Default to the collectionof all objects of type base-rule-object from this node in the tree down to the leaves,whose violated? message evaluates to NIL.

Other-rules-bgcolor Keyword symbol

Color keyword from *color-table* for the other-rules area background. Defaults to:aquamarine.

Other-rules-title String

Title for the other-rules section. Defaults to ”Other Rules”.

Page-title String

The title to display on the page and in the tree. Defaults to (the strings-for-display).

Show-title? Boolean

Indicates whether to display the title at the top of the page. Defaults to T.

Tree-bgcolor Keyword symbol

Color keyword from *color-table* for the tree area background. Defaults to :aquamarine.

Tree-title String

Title for the Tree section. Defaults to ”Assembly Tree” if the tree-root is only a subclassof application-mixin, and ”Assembly Tree” if the tree-root is an actual node withchild applications.

Ui-display-list-leaves List of GDL objects

This should be overridden with a list of objects of your choice. These objects (not theirleaves, but these actual nodes) will be scaled to fit and displayed in the graphics area.Defaults to NIL.

Ui-display-list-objects List of GDL objects

This should be overridden with a list of objects of your choice. The leaves of theseobjects will be scaled to fit and displayed in the graphics area. Defaults to NIL.

Page 196: Genworks GDL: A User's Manual - Genworks International

190 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Violated-rules List of GDL objects of type base-rule-object or (preferably) gwl-base-rule-object

. Links to these will be displayed in the other-rules section. Default to the collectionof all objects of type base-rule-object from this node in the tree down to the leaves,whose violated? message evaluates to non-NIL.

Violated-rules-bgcolor Keyword symbol

Color keyword from *color-table* for the violated-rules area background. Defaults to:aquamarine.

Violated-rules-title String

Title for the violated-rules section. Defaults to ”Violated Rules”.

Width Number

Width of the graphics viewport. Default is 300.

Input slots (optional, defaulting):

Display-rules? Boolean

Indicates whether the Rules panel should be displayed. Defaults to T.

Display-tree? Boolean

Indicates whether the Tree area should be displayed. Defaults to T.

Graphics-height Integer

Height (top to bottom on screen) in pixels of the graphics area. Defaults to 500.

Graphics-width Integer

Height (left to right on screen) in pixels of the graphics area. Defaults to 500.

Use-standard-saved-slots? Boolean

Determines whether the standard-saved-slots are automatically used by default for thesaved-slots. This is a trickle-down slot so its value will be passed to descendent objectsautomatically. The default value is NIL.

Computed slots:

Saved-slots List of keyword symbols or lists

. The first of this list should be the unique name for this tree node for the purposesof saving slots. The rest of this list is made up of either keyword symbols or lists. Akeyword symbol indicates the name of a slot to be saved in the current object. Theseslot names should correspond to :settable slots of this object. A list indicates slots tobe saved in a child object, specified as follows: the first of the list is the name of thechild part, and the rest is made up of keywords naming the slots in the child part tobe saved. These should correspond to :settable slots in the child object. The defaultvalue is the standard-saved-slots if the use-standard-saved-slots? is non-NIL,NIL otherwise.

Standard-saved-slots List of keyword symbols

The first of this list is the name-for-display of this object. The rest of the list areall the keyword symbols representing the settable computed-slots and input-slots which

Page 197: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 191

...

:objects

((menu-1 :type ’menu-form-control

:choice-plist (list 1 "one" 2 "two")))

...

Figure 11.60: Example Code for gwl:menu-form-control

have a default value. Required input-slots (i.e. input-slots without a default value) arenot included in this list. If you wish to include required inputs with the saved-slots, youshould explicitly append them to this list when specifying the saved-slots.

Hidden objects:

View-object GDL web-drawing object

This must be overridden in the specialized class.

Gdl functions:

Read-saved-slots Void

Reads the slots data from filename, restores the corresponding slots in this object andmatching descendant objects, and calls the restore! function on each object.

Write-html-sheet Void

This GDL function should be redefined to generate the HTML page corresponding tothis object. It can be specified here, or as the main-sheet output-function in an html-format lens for this object’s type. This write-html-sheet function, if defined, willoverride any main-sheet function defined in the lens. Typically a write-html-sheet

function would look as follows:

Write-saved-slots Void

Writes the unique application name names and values of all saved-slots in this and alldescendants which are of type node-mixin or application-mixin.

• menu-form-control

Mixins: base-form-control, vanilla-mixin

Author Dave Cooper, Genworks

Description This represents a SELECT form control tag wrapping some OPTION tags.OPTIONGROUP is not yet implemented, but will be.

Input slots (optional):

Page 198: Genworks GDL: A User's Manual - Genworks International

192 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Choice-list List

Display values, also used as return values, for selection list. Specify this or choice-plist,not both.

Choice-plist Plist

Keywords and display values for the selection list. Specify this or choice-list, not both.

Choice-styles Plist

Keywords and CSS style for display of each choice. The keys should correspond to thekeys in choice-plist, or the items in choice-list if no choice-plist is given.

Disabled-keys List of keyword symbols

Each of these should match a key in the choice-plist, and where there is a match, thatkey will be disabled in the rendering.

Multiple? Boolean

Are multiple selections allowed? Default is nil.

Possible-nil? Boolean

Indicates whether this should be included in possible-nils. Defaults to (the multiple?)

Size Number

How many choices to display

Test Predicate function of two arguments

Defaults based on type of first in choice-plist: eql for keywords, string-equal for strings,and equalp otherwise.

• node-mixin

Mixins: layout-mixin

Description Generates a default GWL user interface with a model-inputs area, user-navigabletree with child applications, graphics view with controls, and rule display.

Child objects should be of type node-mixin or application-mixin. Child hidden-objects may be of any type.

The ui-display-list-objects is appended up automatically from those of the chil-dren.

Input slots (optional):

Default-tree-depth Integer

Determines how many descendant levels to show in the tree initially. Default is 1.

Node-ui-display-list-objects GDL object list

Appends additional objects to the automatically-appended ui-display-list-objects

from the children.

Computed slots:

Page 199: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 193

Ui-display-list-leaves List of GDL objects

This should be overridden with a list of objects of your choice. These objects (not theirleaves, but these actual nodes) will be scaled to fit and displayed in the graphics area.Defaults to NIL.

Ui-display-list-objects List of GDL object roots

The leaves of these objects will be displayed in the graphics. Defaults to the appendedresult of children’s ui-display-list-objects.

• radio-form-control

Mixins: menu-form-control, vanilla-mixin

Description Produces a standard radio-button form control.

Input slots (optional):

Description-position Keyword symbol or nil

Specifies where the description for each radio goes, if any. Can be:

:paragraph-prepend (or :p-prepend or :p) Description goes in a paragraph tagbefore the input tag.

:paragraph-append (or :p-append) Description goes in a paragraph tag after theinput tag

:table-row-prepend (or :table-tr or :table-tr-prepend) Description goes in a ta-ble cell wrapped in a table row before the input tag table cell

:table-row-append (or :table-tr-append) Description goes in a table cell wrappedin a table row after the input tag table cell

nil (or any other value) No description, only the bare input tag for the radio

Default is :paragraph-append.

Table-class String

Allows you to specify a class for the table surrounding the radio input elements. Defaultsto empty string.

Computed slots:

Multiple? Boolean

Are multiple selections allowed? Default is nil.

• session-control-mixin

Mixins: vanilla-mixin

Author Brian Sorg, Liberating Insight LLC (revised Dave Cooper, Genworks)

Description Mixin to the root object of the part which you wish to have session controlover

Page 200: Genworks GDL: A User's Manual - Genworks International

194 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

FLAG -- fill in!!!

Figure 11.61: Example Code for gwl:sheet-section

Input slots (optional):

Org-type Type of original object, useful when viewing session report log

Recovery-expires-at Expiration time of the recovery object

After the recovery object has replaced the orginal instance at what time should therecovery instance expire?

Recovery-url Url to which a user will be redirected if requesting a session that has beencleared

Session-duration Length of time a session should last without activity in minutes

Use-recovery-object? Boolean

Determines whether expired sessions are replaced by recovery object. Default is nil.

Input slots (optional, settable):

Expires-at Universal time after which the session should expire

Gdl functions:

Clear-expired-session This is the function called to check for and handle session control

Clear-now? Boolean

Test to run to see if this session has expired and needs to be cleared now.

Session-clean-up Gets called right before the instance is going to get cleared

Is intended to be used to stop any instance states that may not be elequently handledby the garbage collector. ie database connections, multiprocessing locks, open streamsetc.

Set-expires-at Method which will set the expires-at slot to the current time + the session-duration

• sheet-section

Mixins: skeleton-ui-element, vanilla-mixin

Description Basic mixin to support an object representing a section of an HTML sheet (i.e.web page). Currently this simply mixes in skeleton-ui-element, and the functionality isnot extended. Sheet-section is also mixed into base-html-sheet, so it and any of itssubclasses will be considered as sheet-sections if they are the child of a base-ajax-sheet.

Page 201: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 195

• skeleton-form-control

Mixins: skeleton-ui-element, vanilla-mixin

Author Dave Cooper, Genworks

Description Computes standard values for base-form-control and similar container objects,e.g. grid-form-control.

Does not perform the actual bashing and computation of result value, should be mixedin to something which does this.

Input slots (optional):

Class String

You can use this to specify a user-defined class for the form-control. Defaults to nil,which means no class attribute will be generated.

Id Keyword symbol

The ID attribute for this tag. Defaults to (the field-name).

Primary? Boolean

Set this to t if the form-control should always occur first in an outputted snapshot file.Defaults to nil.

Computed slots:

Field-name Keyword symbol

The name of this field. Computed from the object name within the tree.

Form-control String of valid HTML

This is the default HTML which can be included in a form in a web page to displaythis form control. Previously known as form-control-string. Default is the form-control-string.

Form-control-string String of valid HTML

Also known as simply form-control. This is the default HTML which can be includedin a form in a web page to display this form control. Default is the output from form-control method of the lens for html-format and the specific type of this object, returnedas a string.

Form-controls List of GDL objects

All the children or hidden-children of type base-form-control.

Html-string String of valid HTML

This is the default HTML which can be included in a form in a web page to display thisform control, wrapped with labels and table cells.

• skeleton-ui-element

Mixins: vanilla-mixin

Page 202: Genworks GDL: A User's Manual - Genworks International

196 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

FLAG -- Fill in!!!

Figure 11.62: Example Code for gwl:skeleton-ui-element

Description Basic mixin to support constructing a gdl ajax call relative to this node. Notethat in order for a node to represent a section of a web page, you should use sheet-section(which mixes this in), rather than this raw primitive.

This is a mixin into base-html-sheet, and some of the previous base-html-sheet function-ality has been factored out into this mixin.

Of special note in this object is thefunction gdl-ajax-call which generates Javascriptappropriate for attaching with a UI event, e.g. onclick, onchange, onblur, etc. In thisJavascript you can specify a GDL function (on this object, self) to be run, and/or specifya list of form-control objects which are rendered on the current page, whose values shouldbe submitted and processed (”bashed”) into the server.

Input slots (optional):

Bashee GDL Object

Object to have its settable computed-slots and/or query-plist set from the fields on theform upon submission. Defaults to self.

Dom-id String

This is the auto-computed dom-id which should be used for rendering this section. Ifyou use the main-div HTML string for rendering this object as a page section, then youdo not have to generate the :div tag yourself - the main-div will be a string of HTMLwhich is wrapped in the correct :div tag already.

Force-validation-for List of GDL objects of type form-control

The validation-function will be forced on these objects when a form is submitted, evenif the object’s html form-control does not happen to be included in the values submittedwith the form. Defaults to nil.

Html-sections List of HTML sections to be scanned and possibly replaced in response toGDL Ajax calls. Override this slot at your own risk. The default is all sections who aremost recently laid out on the respondent sheet, and this is set programmatically everytime the sheet section’s main-div is demanded.

Inner-html String

This can be used with (str .) [in cl-who] or (:princ .) [in htmlGen] to output thissection of the page, without the wrapping :div tag [so if you use this, your code wouldbe responsible for wrapping the :div tag with :id (the dom-id).]

Js-to-eval String of valid Javascript

This Javascript will be send with the Ajax response, and evaluated after the innerHTMLfor this section has been replaced.

Page 203: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 197

Ordered-form-controls List of GDL objects, which should be of type ’base-form-control

.

[Note – this slot is not really necessary for protecting out-of-bounds sequence referencesanymore, the form-control processor protects against this by itself now].

These objects are validated and bashed first, in the order given. If the cardinality of oneform-control depends on another as in the example below, then you should list thosedependent objects first. Default is nil.

Possible-nils List of keyword symbols

Messages corresponding to form fields which could be missing from form submission(e.g. checkbox fields). Defaults to the names of any children or hidden-children of typemenu-form-control or checkbox-form-control.

Input slots (optional, defaulting):

Respondent GDL Object

Object to respond to the form submission. Defaults to self.

Computed slots:

Failed-form-controls List of GDL objects

All the form-controls which do not pass validation.

Form-controls List of GDL objects

All the children or hidden-children of type base-form-control.

Main-div% String

This should be used with (str .) [in cl-who] or (:princ .) [in htmlGen] to output thissection of the page, including the wrapping :div tag.

Preset-all? Boolean

This switch determines whether all form-controls should be preset before the final setting,in order to allow any interdependencies to be detected for validation or detecting changedvalues. If this is specified as a non-nil value, then any nil values of (the preset?) onindividual form controls will be ignored. If this is specified as nil, then (the preset?) ofindividual form-controls (default of these is also nil) will be respected. Default is nil.

Gdl functions:

Gdl-ajax-call String

. This function returns a string of Javascript, appropriate to use for events such as:onclick, :onchange, etc, which will invoke an Ajax request to the server, which willrespond by replacing the innerHTML of affected :div’s, and running the Javascript in-terpreter to evaluate (the js-to-eval), if any.

• text-form-control

Mixins: base-form-control, vanilla-mixin

Page 204: Genworks GDL: A User's Manual - Genworks International

198 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Author Dave Cooper, Genworks

Description This represents a INPUT TYPE=TEXT or TEXTAREA form control tag.

Input slots (optional):

Cols Integer

The number of columns for a TEXTAREA (if rows is ¿ 1). Defaults to (the size).

Number? Boolean

Specifies whether this should be a number form control with support for numerical input.Defaults to nil. Use number-form-control to get a default of t.

Password? Boolean

Specifies whether this should be a password form control with obscured screen text.Note that this does not automatically give encrypted transmission to the server - youneed SSL for that. Defaults to nil. Use password-form-control to get a default of t.

Rows Integer

The number of rows. If more than 1, this will be a TEXTAREA. Defaults to 1.

• web-drawing

Mixins: renderer-mixin, base-drawing

Description Container object for displaying a view of geometric or text-based entities ina web application. This is supposed to be the type of the view-object hidden-child ofbase-html-graphics-sheet. Also, in a GWL application using application-mixin, you caninclude one object of this type in the ui-display-list-leaves.

Input slots (optional):

Immune-objects List of GDL objects

These objects are not used in computing the scale or centering for the display list.Defaults to nil.

Object-roots List of GDL objects

The leaves of each of these objects will be included in the geometry display. Defaults tonil.

Objects List of GDL objects

These nodes (not their leaves but the actual objects) will be included in the geometrydisplay. Defaults to nil.

Projection-vector 3D vector

This is the normal vector of the view plane onto which to project the 3D objects. Defaultsto (getf *standard-views* :top).

Raphael-canvas-id String

Unique ID on the page for the raphael canvas div. By default this is passed in fromthe base-ajax-graphics-sheet and based on its root-path, but can be specified manuallyif you are making a web-drawing on your own. Defaults (in the standalone case) to”RaphaelCanvas”

Page 205: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 199

(in-package :gwl-user)

(define-object test-html-graphics-sheet (base-html-graphics-sheet)

:objects

((b-splines :type ’test-b-spline-curves)

(boxed-spline :type ’surf:boxed-curve

:curve-in (the b-splines (curves 0))

:orientation (alignment :top (the (face-normal-vector :rear)))

:show-box? t)

(view-object :type ’web-drawing

:page-length (the graphics-height value)

:page-width (the graphics-width value)

:projection-vector (getf *standard-views* (the view))

:object-roots (the ui-display-roots))

(graphics-height :type ’text-form-control

:default 350)

(graphics-width :type ’text-form-control

:default 500)

(bg-color :type ’text-form-control

:default :black)

(fg-color :type ’text-form-control

:default :white))

:computed-slots

((background-color (lookup-color (the :bg-color value) :format :decimal))

(foreground-color (lookup-color (the :fg-color value) :format :decimal))

(view :trimetric :settable)

("list of gdl objects. Objects to be displayed in the graphics window."

ui-display-roots (list (the b-splines) (the boxed-spline)))))

(define-lens (html-format test-html-graphics-sheet)()

:output-functions

((main-sheet

()

(with-html-output (*html-stream* nil :indent t)

(:html (:head (:title "Test HTML Graphics Sheet"))

(:body (when gwl:*developing?* (the write-development-links))

(:h2 (:center "Test HTML Graphics Sheet"))

(with-html-form (:cl-who? t)

(:table (:tr (:td (:ul

(:li (str (the graphics-height html-string)))

(:li (str (the graphics-width html-string)))

(:li (str (the bg-color html-string)))

(:li (str (the fg-color html-string))))

(:p (:input :type :submit :value " OK ")))

(:td (write-the geometry)))))))))))

(publish :path "/t-h-g-s"

:function #’(lambda(req ent)

(gwl-make-object req ent "gwl-user::test-html-graphics-sheet")))

(define-object test-b-spline-curves (base-object)

:input-slots

((control-points (list (make-point 0 0 0)

(make-point 2 3.0 0.0)

(make-point 4 2.0 0.0)

(make-point 5 0.0 0.0)

(make-point 4 -2.0 0.0)

(make-point 2 -3.0 0.0)

(make-point 0 0 0))))

:objects

((curves :type ’surf:b-spline-curve

:sequence (:size 6)

:control-points (the control-points)

:degree (1+ (the-child :index))

:display-controls (list :line-thickness (* 0.3 (the-child index))

:color (ecase (the-child index)

(0 :red) (1 :orange) (2 :yellow) (3 :green)

(4 :blue) (5 :red-violet))))

(points :type ’point

:sequence (:size (length (rest (the control-points))))

:center (nth (the-child index) (rest (the control-points)))

:display-controls (list :color :green))))

Figure 11.63: Example Code for gwl:web-drawing

Page 206: Genworks GDL: A User's Manual - Genworks International

200 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Computed slots:

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

Image-file Pathname or string

Points to a pre-existing image file to be displayed instead of actual geometry for thisobject. Defaults to nil

Objects:

Main-view GDL object of type geom-base:base-view

This is the actual drawing view which is used to present the geometry. Defaults to aninternally-computed object, this should not be overridden in user code.

11.14.2 Function and Macro Definitions

• base64-decode-list

(type List intro Decodes a base64 string into a Lisp list. arguments (string string))

• base64-decode-safe

(type String intro Decodes a base64 string without need for trailing = signs into a decodedstring. arguments (string string))

• base64-encode-list

(type String intro Encodes a list into base64 without the trailing = signs. arguments (listlist))

• base64-encode-safe

(type String intro Encodes a string into base64 without the trailing = signs. arguments (stringstring))

• clear-all-instances

(type Void intro Clears all instances from GWL’s master table of root-level instances. Theinstance IDs are the numbers you see in published GWL URIs, and are available as the”instance-id” message within each GWL object which inherit from base-html-sheet. Clear-ing all the instances makes available for garbage collection all memory used by the objecthierarchies rooted at the instances, as well as all associated published URIs. example ¡pre¿(clear-all-instance) ¡/pre¿ )

• clear-instance

(type Void intro Clears the specified instance from GWL’s master table of root-level instances.The instance ID is the same number you see in published GWL URIs, and is available as the”instance-id” message within all GWL objects which inherit from base-html-sheet. Clearingthe specified instance makes available for garbage collection all memory used by the object

Page 207: Genworks GDL: A User's Manual - Genworks International

11.14. GWL (GENERATIVE WEB LANGUAGE (GWL)) 201

hierarchy rooted at the instance, as well as all associated published URIs. arguments (idInteger or Keyword Symbol. The key whose entry you wish to clear from the *instance-hash-table*.) example ¡pre¿ (clear-instance 639) ¡/pre¿ )

• clear-old-timers

(type Void intro This is a lighter-weight alternative to the session-object-mixin for timingout instances in a web application. &key ((idle-time-required 600) Time in seconds. Themaximum age of a session for timeout.))

• crawl

(type Void intro Instantiates and “Crawls” a given object instance and creates static HTMLpages reflecting the instance tree. This means it will recursively follow all the links for theobject. By default the files are written into ”/tmp/sites/”. arguments (part String. Names apackage-qualified part which should mix in ¡tt¿base-html-sheet¡/tt¿.) &key ((host localhost)String. Host on which the server is running. (port 9000) Integer. Port on which the server isrunning. (output-root /tmp/sites/[non-package-qualified-part-name]/) String or pathname.Directory where filfes will be written make-part-args Plist. Other make-instance argumentsto use to initialize the object.) example ¡pre¿ (gwl:crawl ”yadd:assembly”) ¡/pre¿ )

• gwl-make-object

(type Void intro Used within the context of the body of a :function argument to Allegroserve’spublish function, makes an instance of the specified part and responds to the request witha redirect to a URI representing the instance. arguments (req Allegroserve request object,as used in the function of a publish ent Allegroserve entity object, as used in the functionof a publish package-and-part String. Should name the colon- (or double-colon)-separatedpackage-qualified object name) &key ((make-object-args nil) Plist of keys and values. Theseare passed to the object upon instantiation. (share? nil) Boolean. If non-nil, the instance IDwill be the constant string “share” rather than a real instance id.) example ¡pre¿ (publish :path”/calendar” :function #’(lambda(req ent) (gwl-make-object req ent ”calendar:assembly”)))¡/pre¿ )

• publish-gwl-app

(type Void intro Publishes an application, optionally with some initial arguments to be passedin as input-slots. arguments (path String. The URL pathname component to be published.string-or-symbol String or symbol. The object type to insantiate.) &key (make-object-argsPlist. Extra arguments to pass to make-object.))

• publish-shared

(type Void intro Used to publish a site which is to have a shared toplevel instance tree,and no URI rewriting (i.e. no ”/sessions/XXX/” at the beginning of the path). So, thissite will appear to be a normal non-dynamic site even though the pages are being generateddynamically. &key ((path nil) String. The URI path to be published. (object-type nil)Symbol. The type of the toplevel object to be instantiated. (host nil) hostname for the URIto be published. (server *wserver*) Allegroserve server object. If you have additional serversother than the default ¡tt¿*wserver*¡/tt¿ (e.g. an SSL server) you may want to call this

Page 208: Genworks GDL: A User's Manual - Genworks International

202 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

function for each server.) example ¡pre¿ (publish-shared :path ”/” :object-type ’site:assembly:host (list ”www.genworks.com” ”ww2.genworks.com” ”mccarthy.genworks.com”)) ¡/pre¿ )

• publish-string-content

(type String (representing a url path) intro Publishes given url to respond with text contentas specified by given string. arguments (url String. The url to be published. string String.The content to be emitted when the url is requested.) &rest (publish-args plist. Argumentsto be passed on to publish function, e.g. :content-type.))

• relativize-pathname

(type nil intro Return a relative pathname for TARGET-PATHNAME that can be reachedfrom the directory that TARGET-PATHNAME refers to. )

• session-control-auto-refresh

(type Adding this javascript function into the header of a web page will cause the page totimeout and reload repeatedly intro This is intended to be used such that when an instanceis open in an active browser the page will automatically update the expires-at function evenif the operator takes an extended break from the application. It works by checking if anyforms exist on this page. If they do it will submit the first form on the page when thetimeout value is reached. This is done to avoid the Post Data confirmation warning thatmost browser present. If no forms are found it will use the reload(true) function to reload thepage. arguments (timeout Time in seconds between page reloads) &optional (html-streamStream which the output should be sent to. Default is *html-stream*))

• session-report

(type Returns list of instances in a runtime environment intro Those that are of type session-control-mixin, it provides more detailed information, that can be useful in tracking the sessionlife. Currently, this is intended to run from the lisp command prompt. )

• with-cl-who [Macro]

(type Form intro Sets up body to be evaluated with cl-who and output the resulting stringto the default *stream* Note that the args are spliced into cl-who:with-html-output after*stream* nil, so for example you can do ¡pre¿ (with-cl-who (:indent t) ...) ¡/pre¿ and it willexpand into: ¡pre¿ (with-html-output (*stream* nil :indent t) ...) ¡/pre¿ . )

• with-cl-who-string [Macro]

(type Form intro Sets up body to be evaluated with our with-cl-who return the resultingstring instead of side-effecting anything at all to the default *stream*. )

• with-html-form [Macro]

(type Enclose a body of code with a form intro . FLAG – fill in. )

11.14.3 Variables and Constants

• *break-on-set-self?*

Page 209: Genworks GDL: A User's Manual - Genworks International

11.15. IQ 203

• *bypass-security-check?*

• *developing?*

• *ent*

• *failed-request-url*

• *instance-finalizers*

• *instance-hash-table*

• *jump-to-toplevel-on-set-self?*

• *max-id-value*

• *query*

• *reap-expired-sessions?*

• *recovery-url-default*

• *req*

11.15 iq

11.16 jquery

11.17 raphael

11.18 robot (Simplified Android Robot example )

11.19 smlib (Interface to SMLib Geometry Engine)

11.20 surf (NURBS Surface and Solids Geometry Primitives)

11.20.1 Object Definitions

• 3d-approximated

Mixins: approximated-curve, vanilla-mixin

Description Given a curve in uv parameter space of a surface, produce a corresponding 3dcurve with brute-force fitting techniques.

Input slots (required):

Surface GDL Surface object

The surface corresponding to the given uv-curve.

Page 210: Genworks GDL: A User's Manual - Genworks International

204 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Uv-curve GDL Curve object

Curve whose points are understood to be 2D u, v parameter values on the surface.

Input slots (optional):

Number-of-samples Integer

How many point samples to take for fitting purposes. Default is 42.

Tolerance-factor Number

The tolerance for the final approximation, to be multiplied by the 3d curve length.Default is 10e-5.

Computed slots:

Curve-in GDL Curve object

The curve to be approximated with this curve.

Tolerance Number

The maximum distance deviation from the curve-in to this curve. Defaults to 1.0e-5times the diagonal of the bounding box of the input curve.

• 3d-curve

Mixins: b-spline-curve, vanilla-mixin

Description Given a uv on-surface curve and its surface, produce the corresponding 3dcurve. Note this must be a true on-surface curve, not just an arbitrary curve whosedomain happens to be in the parameter space of the surface.

Input slots (required):

Surface GDL Surface object

The surface corresponding to the given uv-curve.

Uv-curve GDL Curve object

Curve which is a proper on-surface curve (e.g. produced by a project or drop operationonto the surface).

Computed slots:

Control-points List of 3D Points

The control points.

Degree Integer

Degree of the curve. Defaults to 3 (cubic).

Knot-vector List of Numbers

Knots of the curve. Default is NIL, which indicates a uniform knot vector.

Page 211: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 205

Weights List of numbers

A weight to match each control point. Should be same length as control-points. Defaultis a value of 1.0 for each weight, resulting in a nonrational curve.

• approximated-curve

Mixins: curve

Description This primitive accepts a NURBS curve and computes a new NURBS curvewith presumably fewer control points, and claims to hold it to within a certain toleranceof the original curve.

The point at the start parameter and the end parameter in the result curve will be fixedto be identical to the original curve.

You can use the pinned-parameters input-slot to specify additional parameter valueswhere the new curve will be pinned to be identical with the original curve.

NOTE: This object is currently non-functional and is expected to be re-activated inGDL 1585.

Input slots (required):

Curve-in GDL Curve object

The curve to be approximated with this curve.

Input slots (optional):

Match-parameterization? Boolean

Indicates whether the new-curve should contain matching parameterization betweenbreakpoints. If nil, the parameterization can slip a little, but not very much. Allow-ing the parameterization between breakpoints to slip results in somewhat fewer controlpoints. Use non-nil only if a parameter-to-parameter match is important to your appli-cation. The default is nil.

Pinned-parameters List of numbers

These are parameter values from the original curve where the approximated curve willbe forced to be identical to the original curve. Defaults to nil.

Tolerance Number

The maximum distance deviation from the curve-in to this curve. Defaults to 1.0e-5times the diagonal of the bounding box of the input curve.

Computed slots:

Achieved-tolerance Number

This should reflect the actual tolerance achieved with the approximation. In the case ofsmlib, it is not clear exactly what this value is supposed to mean – from examples wehave seen so far, the value appears to range between 0.0 and 1.0, and it appears thatvalues close to 1.0 indicate a close approximation, and values close to 0.0 indicate a looseapproximation..

Page 212: Genworks GDL: A User's Manual - Genworks International

206 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(define-object approximated-curve-test (base-object)

:input-slots

((sample-b-spline-data

’((#(-7.773502691896258 10.0 0.0)

#(-7.76304131662674 10.0 0.0035356993309923)

#(-7.746775287947699 10.0 0.0067001904580447)

#(-7.7253289934578415 10.0 0.0091817670732663)

#(-7.709372706886673 10.0 0.0109178383762297)

#(-7.693497618275636 10.0 0.0129741578942581)

#(-7.676981089448407 10.0 0.0152725944452429)

#(-7.660626985913543 10.0 0.0176076438762828)

#(-7.644400043044812 10.0 0.0198301741704749)

#(-7.628572854579257 10.0 0.0218811393098875)

#(-7.612456095337886 10.0 0.023892087537815)

#(-7.596123157036033 10.0 0.025876731740358)

#(-7.5797886014351645 10.0 0.0278392394943197)

#(-7.563598247718005 10.0 0.0297977372116626)

#(-7.54734474235553 10.0 0.0317827355165938)

#(-7.530817428296935 10.0 0.0338094455691551)

#(-7.514499984995836 10.0 0.0358111584598995)

#(-7.498530032892328 10.0 0.037762615650263)

#(-7.482560694806967 10.0 0.0396996233035483)

#(-7.466938587271525 10.0 0.0415717500361984)

#(-7.45613073401155 10.0 0.0428492028474684)

#(-7.445702016561547 10.0 0.04407409984323)

#(-7.439862498458236 10.0 0.0447555129227675)

#(-7.429535001467346 10.0 0.0459531655261334)

#(-7.423946015929491 10.0 0.0465975377728551)

#(-7.413554192167366 10.0 0.0477892161812883)

#(-7.407595596706495 10.0 0.0484686195293404)

#(-7.396934499325897 10.0 0.049677834187285)

#(-7.391025013196135 10.0 0.0503446277462212)

#(-7.380668397266659 10.0 0.0515077909624895)

#(-7.374959869886305 10.0 0.0521461185088044)

#(-7.36464849713204 10.0 0.05329441651439)

#(-7.3587350147730115 10.0 0.0539501551169936)

#(-7.348489965069932 10.0 0.0550810605426388)

#(-7.342793963594458 10.0 0.0557070781305422)

#(-7.332490622079339 10.0 0.0568343892437064)

#(-7.3264770440672065 10.0 0.0574891649794912)

#(-7.316219293859572 10.0 0.0586004349229853)

#(-7.310517864890045 10.0 0.0592151399809975)

#(-7.300540086253307 10.0 0.0602855343476251)

#(-7.294748391590457 10.0 0.0609037603868834)

#(-7.284555892216601 10.0 0.061985955452512)

#(-7.278577998313509 10.0 0.062617198511794)

#(-7.268114585011737 10.0 0.0637157114288265)

#(-7.261986919319522 10.0 0.0643552477004073)

#(-7.2514547970306005 10.0 0.0654480650996109)

#(-7.245363578736502 10.0 0.066076354340049)

#(-7.235168395459871 10.0 0.0671217900147562)

#(-7.2293285386923625 10.0 0.0677172614089348)

#(-7.219456797793601 10.0 0.0687181850892115)

#(-7.21363748676987 10.0 0.0693049508093313)

#(-7.203721331045569 10.0 0.0702991235190865)

#(-7.197774951476638 10.0 0.0708918760373581)

#(-7.18753366922008 10.0 0.071906820780931)

#(-7.181328324859931 10.0 0.0725180648535886)

#(-7.170908624453838 10.0 0.0735382495023682)

#(-7.164741045570452 10.0 0.0741384240225961)

#(-7.154470299979475 10.0 0.0751317627718068)

#(-7.1483716586933825 10.0 0.0757179834474372)

#(-7.138406833936611 10.0 0.0766699111117332)

#(-7.132501722803377 10.0 0.0772306457809111)

#(-7.12244815794467 10.0 0.0781794021319588)

#(-7.116194798062766 10.0 0.0787657100109435)

#(-7.105880729941813 10.0 0.0797262397246034)

#(-7.099656569353997 10.0 0.0803020171513102)

#(-7.089330480447966 10.0 0.0812507479304588)

#(-7.083006810743995 10.0 0.0818277014224611)

#(-7.0730076945596645 10.0 0.0827335903150743)

#(-7.067069212658176 10.0 0.0832680013237252)

#(-7.057382524393892 10.0 0.0841338221164179)

#(-7.0513228782074515 10.0 0.0846717275930971)

#(-7.041364101581027 10.0 0.0855495109968372)

#(-7.035106540724323 10.0 0.0860970019877134)

#(-7.024857742651612 10.0 0.0869868797241497)

#(-7.018438815809276 10.0 0.087539916228507)

#(-7.008168401811841 10.0 0.0884178150543803)

#(-7.00184087536049 10.0 0.0889544270356334)

#(-6.9919619641004545 10.0 0.0897854973995385)

#(-6.985881827579846 10.0 0.0902930555610231)

#(-6.976281029598491 10.0 0.0910882693796495)

#(-6.970184675056803 10.0 0.091589260852436)

#(-6.960320705968006 10.0 0.0923932980242485)

#(-6.953917746465384 10.0 0.0929107533519837)

#(-6.943757762558306 10.0 0.0937245181023455)

#(-6.937303992646001 10.0 0.0942367919470313)

#(-6.9271520790382235 10.0 0.0950351703452132)

#(-6.920707811824021 10.0 0.0955372165209965)

#(-6.910885266876965 10.0 0.0962951353561948)

#(-6.904716963255798 10.0 0.096766697374172)

#(-6.895200295978004 10.0 0.0974873900684733)

#(-6.889018398304428 10.0 0.0979511004533426)

#(-6.8792396786986085 10.0 0.0986773910779738)

#(-6.8727507213 10.0 0.0991543261574633)

#(-6.86267690754424 10.0 0.0998867125969024)

#(-6.856136640740504 10.0 0.100356993136921)

#(-6.846050345447107 10.0 0.1010740145138523)

#(-6.839489198598122 10.0 0.1015350665777411)

#(-6.829441747557248 10.0 0.1022327061061873)

#(-6.82289308331905 10.0 0.1026819075455008)

#(-6.813152437915218 10.0 0.1033417487088309)

#(-6.806847948189532 10.0 0.103763701703458)

#(-6.7971454958195565 10.0 0.1044050485135838)

#(-6.790595307231813 10.0 0.10483231339683)

#(-6.780922064334754 10.0 0.1054546472054939)

#(-6.77458575320461 10.0 0.1058569326392236)

#(-6.7649029807976975 10.0 0.1064632879605449)

#(-6.758284636701557 10.0 0.1068717205935851)

#(-6.748340665523174 10.0 0.1074760046701189)

#(-6.741671570163981 10.0 0.1078750063466806)

#(-6.731717886166939 10.0 0.1084609002957398)

#(-6.7250260196879 10.0 0.1088483306291875)

#(-6.715132250830737 10.0 0.1094113701746257)

#(-6.708479289674014 10.0 0.1097833660497434)

#(-6.698863733855831 10.0 0.1103113585573882)

#(-6.692407555733223 10.0 0.1106596095578191)

#(-6.683112518678094 10.0 0.1111518410008553)

#(-6.67673768062156 10.0 0.1114832653763077)

#(-6.667240402771452 10.0 0.1119675047371582)

#(-6.660514775321519 10.0 0.1123033129775543)

#(-6.650681029972996 10.0 0.1127835983503758)

#(-6.643918945899163 10.0 0.1131064056804846)

#(-6.63405272844892 10.0 0.1135663439198465)

#(-6.627254408957563 10.0 0.1138754999668116)

#(-6.617707456082231 10.0 0.1142985673023449)

#(-6.611225484562257 10.0 0.1145786891314138)

#(-6.60204805594244 10.0 0.1149649311892426)

#(-6.595561879720703 10.0 0.1152306714612809)

#(-6.586146787784009 10.0 0.1156055153436167)

#(-6.579359503332465 10.0 0.1158674765410608)

#(-6.569607126249581 10.0 0.1162316741844863)

#(-6.562716518300558 10.0 0.1164802471836087)

#(-6.552941578381875 10.0 0.1168201535727847)

#(-6.546090216293524 10.0 0.1170494074887217)

#(-6.536674084104508 10.0 0.117351835565929)

#(-6.530101252192292 10.0 0.1175545076386553)

#(-6.521003931182706 10.0 0.1178230920419217)

#(-6.514431925615438 10.0 0.1180084927017307)

#(-6.505237782335364 10.0 0.1182554027074824)

#(-6.498513444650254 10.0 0.1184266239748961)

#(-6.488983008492481 10.0 0.1186555956582973)

#(-6.48200268637703 10.0 0.1188128917257091)

#(-6.472326149681036 10.0 0.119016053562057)

#(-6.465389207391072 10.0 0.1191511200864016)

#(-6.455601236135456 10.0 0.1193262289159263)

#(-6.448443729690395 10.0 0.1194424780868816)

#(-6.438958198675441 10.0 0.1195804860871952)

#(-6.432273317606395 10.0 0.1196673012040853)

#(-6.422976238615972 10.0 0.1197731501514096)

#(-6.4159621089377605 10.0 0.1198409999468651)

#(-6.4067002169151355 10.0 0.1199142428159179)

#(-6.399997171744239 10.0 0.119956098103827)

#(-6.390775586474153 10.0 0.1199979664750528)

#(-6.383766014520722 10.0 0.1200169608096984)

#(-6.374398451275458 10.0 0.1200248790095977)

#(-6.367508232676765 10.0 0.1200180617465295)

#(-6.358204641636406 10.0 0.1199913666687163)

#(-6.351212499117087 10.0 0.1199579262946732)

#(-6.34179811653411 10.0 0.1198940830107079)

#(-6.334722008984675 10.0 0.1198318598583616)

#(-6.325243506895607 10.0 0.1197286664953724)

#(-6.3181038668924225 10.0 0.1196359024164523)

#(-6.3086233644061815 10.0 0.1194922029896446)

#(-6.301482992162023 10.0 0.1193683670372235)

#(-6.2919924776063425 10.0 0.1191825584163038)

#(-6.284793044978927 10.0 0.1190252258627906)

#(-6.2753314970647045 10.0 0.1187965753264672)

#(-6.26821135846841 10.0 0.1186078391724031)

#(-6.259162952769228 10.0 0.1183465300397597)

#(-6.252357920075809 10.0 0.1181346604145395)

#(-6.243732250120057 10.0 0.1178464349390531)

#(-6.237024615970206 10.0 0.117607149463944)

#(-6.22847504378218 10.0 0.1172819358381489)

#(-6.221661738722191 10.0 0.1170066698163893)

#(-6.212734929396275 10.0 0.1166237921552943)

#(-6.205560407960056 10.0 0.1162969301785835)

#(-6.196251975857688 10.0 0.1158468244886666)

#(-6.188964185271005 10.0 0.1154735323164374)

#(-6.179555494737541 10.0 0.1149639153426461)

#(-6.172229381962318 10.0 0.1145450494936365)

#(-6.162856146944508 10.0 0.113980051461802)

#(-6.155565515353094 10.0 0.1135177665315744)

#(-6.146209923750142 10.0 0.1128942970314755)

#(-6.138855137820279 10.0 0.112380030061237)

#(-6.129655628386858 10.0 0.1117056172410459)

#(-6.122486612998066 10.0 0.111156182233171)

#(-6.11363265472315 10.0 0.110447376638818)

#(-6.10657159410418 10.0 0.1098584591558712)

#(-6.097764739903218 10.0 0.1090932742430056)

#(-6.0906136679603495 10.0 0.1084460244904774)

#(-6.081792237411942 10.0 0.1076133101575569)

#(-6.074656622637572 10.0 0.106911620109585)

#(-6.065558573551578 10.0 0.1059791445416934)

#(-6.058094902257685 10.0 0.105180297224725)

#(-6.04902211746673 10.0 0.1041654080838163)

#(-6.041837834442202 10.0 0.1033285781165379)

#(-6.032806538284214 10.0 0.102232676388748)

#(-6.025326943718607 10.0 0.1012858590168515)

#(-6.016324551464302 10.0 0.1000962619743535)

#(-6.009099370537937 10.0 0.0991026392362128)

#(-6.000144802087108 10.0 0.0978213410260762)

#(-5.992672802847265 10.0 0.0967077356358815)

#(-5.983682684099936 10.0 0.095311303764513)

#(-5.976390894901862 10.0 0.0941327969909632)

#(-5.967597701948485 10.0 0.092651171023629)

#(-5.960300625393035 10.0 0.091369004729541)

#(-5.951819042895475 10.0 0.0898129037222759)

#(-5.944827122197059 10.0 0.0884764825079818)

#(-5.9364937900430546 10.0 0.086815333082949)

#(-5.929316123058646 10.0 0.0853215712223041)

#(-5.920853977349434 10.0 0.0834809963775036)

#(-5.913697488126982 10.0 0.081855290446912)

#(-5.905045875020715 10.0 0.0797946852900259)

#(-5.897633195865675 10.0 0.077937627548088)

#(-5.888869222952547 10.0 0.0756214894583634)

#(-5.881576422780188 10.0 0.0735895003825018)

#(-5.8730488606276685 10.0 0.071078664456186)

#(-5.865886603820401 10.0 0.0688505661471062)

#(-5.857659076163453 10.0 0.0661282191187038)

#(-5.8506956581380045 10.0 0.0636758008622684)

#(-5.8427993520796395 10.0 0.0607060179365281)

#(-5.836006841543422 10.0 0.0579805075953104)

#(-5.828141782273885 10.0 0.0545732138995477)

#(-5.821264105869612 10.0 0.0513305536611062)

#(-5.813396489418997 10.0 0.0472425696093425)

#(-5.806736741014998 10.0 0.0434068855227238)

#(-5.799296800365852 10.0 0.0385347465920627)

#(-5.793149838865298 10.0 0.0339017049050897)

#(-5.786639267262249 10.0 0.02799360148602)

#(-5.781555952133565 10.0 0.0222871988704581)

#(-5.77690049447455 10.0 0.0149171833984971)

#(-5.774143850809992 10.0 0.0076254582681704)

#(-5.773504871989952 10.0 0.0021812762824132)

#(-5.77350372489622 10.0 -5.432357e-10))

(1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0)

(0.0 0.0 0.0 0.0 0.0160453781542143 0.0241470160269717

0.0317935799490915 0.0398053040025856 0.0478086834801164

0.0560582201696031 0.0639202701209087 0.0718503545073776

0.0797433850046513 0.087981750276748 0.0960087041824917

0.1039831218391125 0.112029495827222 0.1201752268087684

0.1282605498138822 0.136005192477863 0.1438242190390603

0.1519870644337011 0.1593306835295498 0.1598487740853562

0.1674658650196929 0.1680104087509454 0.175157710986505

0.1757272662987668 0.1833705173786548 0.183966778279312

0.1915177150798282 0.1921404682290536 0.1993060375256694

0.1999541159685396 0.2074081735084615 0.2080825976726782

0.2151502427534925 0.2158498418097879 0.2234099696672682

0.2241364268834526 0.2312069092585329 0.2319587197887401

0.2390267110021689 0.239803949187276 0.2470314540979864

0.2478347213119199 0.2551668057971311 0.2559965267399797

0.2633214412146924 0.2641776785913368 0.2711080693997827

0.271989626560843 0.2788004837617649 0.2797070543520855

0.2865857660092436 0.2875176520073938 0.294691617040477

0.2956498608401993 0.3028107414290341 0.303795386191314

0.3108677223812281 0.3118785660342093 0.3186289517157898

0.3196650325637266 0.3267875123448071 0.3278501223901527

0.3348376542335923 0.3359264409310518 0.343017473844114

0.3441328588668275 0.3507020846059745 0.3518424576829762

0.3585158400916831 0.3596816211629636 0.366600003006972

0.3677920713565625 0.3748151183901361 0.3760338998362696

0.3829150808161275 0.3841602009158513 0.3906373023990221

0.3919075328521676 0.3983652317385465 0.3996605911050301

0.406480133489536 0.4078018800878236 0.4145992363495962

0.4159473838404371 0.4227235238201337 0.4240980890623294

0.4304686564547328 0.4318684065502333 0.4382164439562757

0.4396413875379139 0.4463489290384909 0.4478003170276637

0.4544823491094193 0.4559601845464303 0.4626166004905004

0.4641208860785213 0.470751784887656 0.4722825236605759

0.4785036764886068 0.4800596220929673 0.486633503837215

0.4882158852069559 0.4943709597308301 0.4959785009914117

0.502479159396033 0.5041130660952415 0.5105726294674962

0.512232853709101 0.5186483892971976 0.5203348734927932

0.5267087790327916 0.5284214732034318 0.5344904142923997

0.5362284120119565 0.5421342182310729 0.5438970713133418

0.5502033260482438 0.5519924174541494 0.5583120642198542

0.5601275228154484 0.5665206241752909 0.5683627745511391

0.5742736086012711 0.5761409693620999 0.5819524448520371

0.5838447748901722 0.5899961210140513 0.591914606679692

0.5981367389758905 0.6000816954947563 0.6062612328823314

0.6082326078238199 0.6139891743550618 0.6159856782493418

0.6217020223331746 0.623723606100719 0.6295913193586837

0.6316385567589856 0.6377653030384736 0.6398391197873293

0.6458190701143912 0.6479190753033844 0.6541566170946882

0.6562837334911363 0.6618008400206912 0.6639528131422728

0.6699223065860094 0.6721006882862063 0.6775449581602477

0.6797481264419983 0.6856437214610128 0.6878732244971574

0.6935814940177247 0.695836808314546 0.7016366241440788

0.7039181313132697 0.709705856689687 0.7120136025880942

0.7177645246694223 0.7200984749442396 0.7258142875643973

0.7281744132589539 0.7339554983783031 0.7363420968538624

0.7420859180388898 0.7444989542058508 0.7497996761741695

0.7522377951739535 0.7574084721926538 0.7598713327198711

0.7650117024519579 0.7674992864084252 0.7730174533892418

0.7755310696517345 0.7811075108508807 0.7836474335589837

0.7892724115280283 0.7918388840494792 0.7974138106069117

0.8000067565215466 0.8056169748708625 0.8082365950205777

0.8135658669535445 0.816211334521307 0.8213255105466555

0.8239962101530169 0.829242574214828 0.8319390177427586

0.8370829503324179 0.8398048884169548 0.8454152884202761

0.8481643207745085 0.8532523057058028 0.856026821694725

0.8614897782714848 0.8642910800558162 0.8693003110837616

0.8721270103832023 0.8774885682570619 0.8803418933181856

0.8854532218703798 0.8883324456013311 0.8934528695387036

0.8963581057296763 0.9010534532900417 0.9039834043046125

0.9089319065807004 0.9118874759674483 0.9167609857678787

0.9197420129769963 0.9249624084248843 0.9279701042058975

0.9330316439657489 0.9360655784857183 0.9410404196288085

0.9441003962903061 0.9488799412961575 0.9519654097358451

0.9565785237508843 0.9596890256766235 0.9645868244983244

0.9677233670213087 0.9726644785371455 0.9758272871735215

0.9807483303509975 0.9839374252540747 0.9887471809818733

0.9919622857532446 0.996778435740851 1.0 1.0 1.0 1.0)

3)))

:objects ((profile :type ’b-spline-curve

:control-points (first (the sample-b-spline-data))

:weights (second (the sample-b-spline-data))

:knot-vector (third (the sample-b-spline-data))

:degree (fourth (the sample-b-spline-data)))

(approximate :type ’approximated-curve

:display-controls (list :color :red)

:tolerance 0.01

:pinned-parameters (list 0.1 0.5 0.7 0.9)

:match-parameterization? t

:curve-in (the profile))))

(generate-sample-drawing :object-roots (make-object ’approximated-curve-test)

:projection-direction (getf *standard-views* :front)

:page-width 1000)

Figure 11.64: Example Code for approximated-curve

Page 213: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 207

Figure 11.65: approximated-curve example

• arc-curve

Mixins: curve, arc

Description An arc represented exactly as a quadratic NURBS curve. Inputs are the sameas for arc. Messages are the union of those for arc and those for curve.

• b-spline-curve

Mixins: curve

Description A general NURBS (potentially non-Uniform, potentially Rational, b-spline)curve specified with control points, weights, knots, and degree.

If the knot-vector is different from the default, it is non-Uniform.

If any of the weights are different from 1.0, it is Rational.

Input slots (required):

Control-points List of 3D Points

The control points.

Input slots (optional):

Degree Integer

Degree of the curve. Defaults to 3 (cubic).

Page 214: Genworks GDL: A User's Manual - Genworks International

208 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-arc-curve (arc-curve)

:computed-slots

((center (make-point 0 0 0)) (radius 10) (start-angle 0) (end-angle 2pi)))

(generate-sample-drawing :objects (make-object ’test-arc-curve))

(define-object test-arc-curve2 (arc-curve)

:computed-slots

((center (make-point 0 0 0)) (radius 5) (start-angle (* 0.25 pi)) (end-angle pi)))

(generate-sample-drawing :objects (make-object ’test-arc-curve))

Figure 11.66: Example Code for arc-curve

Figure 11.67: arc-curve example

Page 215: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 209

(in-package :surf)

(define-object test-b-spline-curves (base-object)

:input-slots

((control-points (list (make-point 0 0 0)

(make-point 2 3.0 0.0)

(make-point 4 2.0 0.0)

(make-point 5 0.0 0.0)

(make-point 4 -2.0 0.0)

(make-point 2 -3.0 0.0)

(make-point 0 0 0))))

:objects

((curves :type ’b-spline-curve

:sequence (:size 6)

:control-points (the control-points)

:degree (1+ (the-child :index))

:display-controls (list :line-thickness (* 0.3 (the-child index))

:color (ecase (the-child index)

(0 :red) (1 :orange)

(2 :yellow) (3 :green)

(4 :blue) (5 :red-violet))))

(points :type ’point

:sequence (:size (length (rest (the control-points))))

:center (nth (the-child index) (rest (the control-points)))

:display-controls (list :color :green))))

(generate-sample-drawing :object-roots (make-object ’test-b-spline-curves))

;; Here is another example which shows the difference between a

;; simple bezier-curve from the :geom-base package, and a NURBS.

;;

(define-object bezier-and-nurbs (base-object)

:input-slots ((control-points (list (make-point 0 0 0)

(make-point 1 1 0)

(make-point 2 1 0)

(make-point 3 0 0))))

:objects ((points :type ’points-display

:points (the control-points))

(bezier :type ’bezier-curve

;; This will be a geom-base:bezier-curve

:display-controls (list :color :green)

:control-points (the control-points))

(b-spline :type ’b-spline-curve

;; This will be an equivalent surf:b-spline-curve.

:display-controls (list :color :red :bezier-points t)

:control-points (the bezier control-points))

;;

;; The b-spline-curve is a full NURBS curve and so has

;; more inputs than a simple bezier-curve: degree,

;; weights, and knot-vector, so we can do things like:

;;

(b-spline-weighted :type ’b-spline-curve

:display-controls (list :color :purple)

:control-points (the bezier control-points)

:weights (list 1.0 1.2 1.2 1.0))

(b-spline-degree-2 :type ’b-spline-curve

:display-controls (list :color :orange)

:control-points (the bezier control-points)

:degree 2)))

Figure 11.68: Example Code for b-spline-curve

Page 216: Genworks GDL: A User's Manual - Genworks International

210 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.69: b-spline-curve example

Knot-vector List of Numbers

Knots of the curve. Default is NIL, which indicates a uniform knot vector.

Local? Boolean

Indicates whether the inputted control-points should be considered in local coordinatesystem of this object. Default is nil.

Weights List of numbers

A weight to match each control point. Should be same length as control-points. Defaultis a value of 1.0 for each weight, resulting in a nonrational curve.

• b-spline-surface

Mixins: surface

Description A general b-spline surface specified with control points, weights, knots, anddegree.

Input slots (required):

Control-points List of lists of 3D Points

The control net.

Input slots (optional):

U-degree Integer

Degree of surface in U direction. Defaults to 3.

Page 217: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 211

(in-package :surf)

(define-object test-b-spline-surface (b-spline-surface)

:computed-slots

((points-data ’(((0 0 0)(4 1 0)(8 1 0)(10 0 0)(8 -1 0)(4 -1 0)(0 0 0))

((0 0 2) (4 2 2) (8 2 2) (10 0 2) (8 -2 2) (4 -2 2) (0 0 2))

((0 0 4) (4 2 4) (8 2 4) (10 0 4) (8 -2 4) (4 -2 4) (0 0 4))

((0 0 7) (4 1 7) (8 1 7) (10 0 7) (8 -1 7) (4 -1 7) (0 0 7))))

(control-points (mapcar #’(lambda(list)

(mapcar #’apply-make-point list))

(the points-data)))

(display-controls (list :color :periwinkle :line-thickness 2))))

(generate-sample-drawing :object-roots (make-object ’test-b-spline-surface)

:projection-direction :trimetric)

Figure 11.70: Example Code for b-spline-surface

Figure 11.71: b-spline-surface example

Page 218: Genworks GDL: A User's Manual - Genworks International

212 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

U-knot-vector List of Numbers

Knots in U direction. Default is NIL, which indicates a uniform knot vector in Udirection.

V-degree Integer

Degree of surface in V direction. Defaults to 3.

V-knot-vector List of Numbers

Knots in V direction. Default is NIL, which indicates a uniform knot vector in Vdirection.

Weights List of lists of numbers

A weight to match each control point. Should be congruent with control-points (i.e.same number of rows and columns). Default is a value of 1.0 for each weight, resultingin a nonrational surface.

• basic-surface

Mixins: surface

Description This routine constructs a 3D surface by interpolating a set of four boundary3D curves.

Input slots (required):

Curve-bottom GDL curve object

The curve corresponding to the surface bottom boundary .

Curve-left GDL curve object

The curve corresponding to the surface left boundary.

Curve-right GDL curve object

The curve corresponding to the surface right boundary.

Curve-top GDL curve object

The curve corresponding to the surface top boundary.

• blended-solid

Mixins: brep

Description This primitive attempts to fillet one or more edges of a brep solid.

Input slots (required):

Brep GDL Brep object

This is the original solid, whose edges you want to be filleted.

Default-radius Number

This will be used as the fillet radius.

Input slots (optional):

Page 219: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 213

(in-package :gdl-user)

(define-object test-basic-surface (base-object)

:computed-slots

((control-points-u-min (list (make-point 0 0 0 )

(make-point 1 0 0 )

(make-point 2 0 1 )

(make-point 3 0 0 )

(make-point 4 0 0 )))

(control-points-u-max (list (make-point 0 4 0 )

(make-point 1 4 0 )

(make-point 2 4 1 )

(make-point 3 4 0 )

(make-point 4 4 0 )))

(control-points-v-min (list (make-point 0 0 0 )

(make-point 0 1 0 )

(make-point 0 2 1 )

(make-point 0 3 0 )

(make-point 0 4 0 )))

(control-points-v-max (list (make-point 4 0 0 )

(make-point 4 1 0 )

(make-point 4 2 1 )

(make-point 4 3 0 )

(make-point 4 4 0 ))))

:objects

((surf-curve-u-min :type ’fitted-curve

:display-controls (list :color :green :line-thickness 2)

:points (the control-points-u-min))

(surf-curve-u-max :type ’fitted-curve

:display-controls (list :color :green :line-thickness 2)

:points (the control-points-u-max))

(surf-curve-v-min :type ’fitted-curve

:display-controls (list :color :blue :line-thickness 2)

:points (the control-points-v-min))

(surf-curve-v-max :type ’fitted-curve

:display-controls (list :color :blue :line-thickness 2)

:points (the control-points-v-max))

(surface :type ’basic-surface

:display-controls (list :color :red :line-thickness 0.5)

:curve-bottom (the surf-curve-u-min)

:curve-top (the surf-curve-u-max)

:curve-left (the surf-curve-v-min)

:curve-right (the surf-curve-v-max))

(arc-1 :type ’arc-curve

:display-controls (list :color :green :line-thickness 2)

:orientation (alignment :top (the (face-normal-vector :rear)))

:center (make-point 1 0 0)

:radius 1

:start-angle 0

:end-angle pi)

(arc-2 :type ’arc-curve

:display-controls (list :color :green :line-thickness 2)

:orientation (alignment :top (the (face-normal-vector :rear)))

:center (make-point 1 -2 0)

:radius 1

:start-angle 0

:end-angle pi)

(arc-3 :type ’arc-curve

:orientation (alignment :rear (the (face-normal-vector :right)))

:display-controls (list :color :blue :line-thickness 2)

:center (make-point 0 -1 0)

:radius 1

:start-angle 0

:end-angle pi)

(arc-4 :type ’arc-curve

:orientation (alignment :rear (the (face-normal-vector :left)))

:display-controls (list :color :blue :line-thickness 2)

:center (make-point 2 -1 0)

:radius 1

:start-angle 0

:end-angle pi)

(surf-arc :type ’basic-surface

:display-controls (list :color :red :line-thickness 0.5)

:curve-bottom (the arc-1 )

:curve-top (the arc-2 )

:curve-left (the arc-3 reverse )

:curve-right (the arc-4))))

(generate-sample-drawing

:objects (the-object (make-object ’test-basic-surface) surface)

:projection-direction (getf *standard-views* :tri-r-r))

Figure 11.72: Example Code for basic-surface

Page 220: Genworks GDL: A User's Manual - Genworks International

214 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.73: basic-surface example

(in-package :gdl-user)

(define-object blend-sample (base-object)

:objects

((box :type ’box-solid

:length 10 :width 20 :height 15)

(blend :type ’blended-solid

:display-controls (list :color :blue)

:default-radius 3

:brep (the box))))

(generate-sample-drawing :objects (the-object (make-object ’blend-sample) blend)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.74: Example Code for blended-solid

Page 221: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 215

Figure 11.75: blended-solid example

Specs Plist with key :edges

This specifies which edges are to be filleted. The default (nil) means that all edges shouldbe filleted.

• boolean-merge

Mixins: boolean-tolerance-mixin, brep

Description Generalized Merge container for doing boolean operations. This is not tobe used directly, but is mixed into subtracted-solid, united-solid, intersected-solid, andseparated-solid. The specific operation is specified in the respective subclass.

Input slots (required):

Other-brep GDL Brep object or object containing a brep, or list of brep objects or objectcontaining a brep. Second (or rest) of the breps to be merged into the given brep

Input slots (optional):

Allow-multiple-regions? Boolean

If set to non-nil, throw warning but not error if any of the input breps has more than onenon-infinite region. Defaults to *boolean-allow-multiple-regions?*, which itself defaultsto nil.

Angle-tolerance Number

Defaults to *angle-tolerance-radians-default*.

Page 222: Genworks GDL: A User's Manual - Genworks International

216 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Brep GDL Brep object or object containing a brep

First of the breps to be merged

Error-on-invalid? Boolean

If set to non-nil, we throw an error instead of a warning if the resulting brep does notpass the built-in validation test. If nil, we throw a warning but continue to return theresulting brep. Defaults to *boolean-error-on-invalid-brep?* which itself defaults to t.

Sew-and-orient? Boolean

Indicates whether we should try to sew and orient the resulting brep. This defaults to tfor merge operation and nil otherwise.

• boolean-tolerance-mixin

Mixins: vanilla-mixin

Description Implements adaptive tolerancing for certain brep objects.

Input slots (optional):

Approximation-tolerance Number

Defaults to *3d-approximation-tolerance-default* if non-nil. If this value is nil, then thisdefaults to the approximation-tolerance-adaptive.

Approximation-tolerance-adaptive Number

Defaults to the minimum of the adaptive-tolerance of any of the input breps, multipliedby the approximation-tolerance-factor, rounded to nearest multiple of tenths (e.g. it willbe 0.01, 0.001, 0.001), however if this evaluates as zerop, *3d-approximation-tolerance-default* will be used instead.

Approximation-tolerance-factor Number

Defaults to *approximation-tolerance-factor*. This is multiplied by the minimum of theadaptive-tolerance of any of the input breps to produce the approximation-tolerance-adaptive.

• box-solid

Mixins: brep, box

Description A rectangular box represented as a brep solid. Contains the union of messages(e.g. input-slots, computed-slots, etc) from brep and box.

• boxed-curve

Mixins: outline-specialization-mixin, b-spline-curve

Description This object behaves as a hybrid of a curve and a normal box. You pass in acurve-in, and it essentially traps the curve in a box, which will respond to normal GDL:center and :orientation. You can also pass a scale, or scale-x, or scale-y, or scale-z aswith a transformed-curve.

Page 223: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 217

(in-package :surf)

(define-object test-box-solid (box-solid)

:computed-slots ((length 10) (width 20) (height 30)))

(generate-sample-drawing :objects (the-object (make-object ’test-box-solid) )

:projection-direction (getf *standard-views* :trimetric))

Figure 11.76: Example Code for box-solid

Figure 11.77: box-solid example

Page 224: Genworks GDL: A User's Manual - Genworks International

218 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(define-object boxed-curves-test (base-object)

:computed-slots ((b-spline (the b-splines (curves 2))))

:objects

((b-splines :type ’test-b-spline-curves)

(boxed :type ’boxed-curve

:curve-in (the b-splines (curves 2)))

(translated :type ’boxed-curve

:curve-in (the b-spline)

:center (translate (the center) :left 15))

(twisted :type ’boxed-curve

:curve-in (the boxed)

:orientation

(alignment :left (the (face-normal-vector :top))

:rear (rotate-vector-d (the (face-normal-vector :rear))

30

(the (face-normal-vector :top)))))

(rotated :type ’boxed-curve

:curve-in (the b-spline)

:display-controls (list :color :purple)

:orientation

(alignment :left

(rotate-vector-d (the (face-normal-vector :left))

50

(the (face-normal-vector :rear)))))

(rotated-about :type ’boxed-curve

:curve-in (the b-spline)

:display-controls (list :color :purple)

:orientation-center (translate (the center) :right 2.5)

;;:center (translate (the center) :up 5)

:orientation

(alignment :left

(rotate-vector-d (the (face-normal-vector :left))

45

(the (face-normal-vector :rear)))))

(moved-up :type ’boxed-curve

:curve-in (the rotated-about)

:center (translate (the rotated-about center)

:up 7

:left 5))

(straightened :type ’boxed-curve

:curve-in (the moved-up)

:orientation

(alignment

:left

(rotate-vector-d

(the-child curve-in (face-normal-vector :left))

45

(the-child curve-in (face-normal-vector :rear)))

:rear (the-child curve-in (face-normal-vector :rear))))

(rotated-straightened :type ’boxed-curve

:curve-in (the straightened)

:orientation (the moved-up orientation)

:orientation-center

(translate (the-child curve-in center) :up 2.5))

(rotated-straightened-moved :type ’boxed-curve

:curve-in (the rotated-straightened)

:center (translate (the-child curve-in center)

:right 5))

(center-sphere :type ’sphere

:radius 0.3

:center (the moved-up-and-straightened orientation-center))

(moved-up-and-straightened

:type ’boxed-curve

:curve-in (the straightened)

:center (translate (the-child orientation-center) :right 7)

:orientation

(alignment :left

(the-child curve-in (face-normal-vector :rear))

:front

(rotate-vector-d (the-child curve-in (face-normal-vector :left))

45

(the-child curve-in (face-normal-vector :rear))))

:orientation-center (translate (the straightened center) :up 2.5))

(moved-up-and-straightened-1

:type ’boxed-curve

:curve-in (the straightened)

:center (translate (the-child curve-in center) :right 14)

:orientation (the rotated-straightened orientation)

:orientation-center (translate (the straightened center) :up 2.5))

(moved-up-and-straightened-2

:type ’boxed-curve

:curve-in (the straightened)

:center (translate (the-child curve-in center) :right 21)

:orientation (the rotated-straightened orientation)

:orientation-center (translate (the straightened center) :up 2.5))

(transformed

:type ’boxed-curve

:curve-in (the b-spline)

:center (translate (the center) :left 50)

:orientation

(alignment :rear

(rotate-vector-d (the (face-normal-vector :rear))

30

(the (face-normal-vector :right)))))))

Figure 11.78: Example Code for boxed-curve

Page 225: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 219

Input slots (required):

Curve-in GDL Curve object

This can be any type of curve, e.g. b-spline-curve, fitted-curve, or an edge from a solidbrep. Note that the reference-box of this curve (i.e. its center and orientation) will havean effect on the resulting boxed-curve. If you want to consider the incoming curve-in asbeing in global space, then make sure its center is (0 0 0) and its orientation is nil orequivalent to geom-base::+identity-3x3+

Input slots (optional):

Center 3D Point in global space

You can pass in a new center for the curve’s reference box, which will move the wholebox including the curve. This defaults to the orientation-center (if given), otherwise tothe (the curve-in center).

From-center 3D Point in global space

The center with respect to which this object should be positioned. Normally this shouldnot be specified by user code, unless you know what you are doing [e.g. to override thecenter of a curve-in which is meaningless and force it to be interpreted as a curve inglobal space, you could specify this as (the center) when passing it in from the parent].Default is (the curve-in center).

From-object GDL object which mixes in base-object

The current boxed-curve will be positioned and oriented with respect to the center andorientation of this object. The default is (the curve-in).

From-orientation 3x3 Transformation Matrix

The orientation with respect to which this object should be oriented. Normally thisshould not be specified by user code, unless you know what you are doing [e.g. tooverride the orientation of a curve-in which is meaningless and force it to be interpretedas a curve in the parent’s coordinate system, you could specify this as (the orientation)when passing it in from the parent]. Default is (the curve-in orientation).

Orientation 3x3 Transformation Matrix

This will be the new orientation for the box and the contained curve. Default is (thecurve-in orientation) – i.e. identical orientation with the provided curve-in.

Orientation-center 3D Point in global space

If you provide this, the curve’s reference box will be moved to have its center at thispoint, before any orientation is applied. This will become the new center of the resultingboxed-curve, unless you explicitly pass in a different center. Default is nil.

Scale Number

The overall scale factor for X, Y, and Z, if no individual scales are specified. Defaults to1.

Scale-x Number

The scale factor for X. Defaults to 1.

Page 226: Genworks GDL: A User's Manual - Genworks International

220 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Scale-y Number

The scale factor for Y. Defaults to 1.

Scale-z Number

The scale factor for Z. Defaults to 1.

Show-box? Boolean

This determines whether the reference box is displayed along with the curve. Default ist (will be changed to nil).

Show-control-polygon? Boolean

This determines whether the control polygon is displayed along with the curve. Defaultis nil.

Show-tight-box? Boolean

This determines whether the tight box is displayed along with the curve. Default is nil.

Translation-threshold Number

Tolerance to determine whether the boxed-curve has moved with respect to the original.Default is *zero-epsilon*

Computed slots:

Control-points List of 3D Points

The control points.

Degree Integer

Degree of the curve. Defaults to 3 (cubic).

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Knot-vector List of Numbers

Knots of the curve. Default is NIL, which indicates a uniform knot vector.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Weights List of numbers

A weight to match each control point. Should be same length as control-points. Defaultis a value of 1.0 for each weight, resulting in a nonrational curve.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• boxed-surface

Mixins: b-spline-surface

Description This object behaves as a hybrid of a surface and a normal box. You pass ina surface-in, and it essentially traps the surface in a box, which will respond to normalGDL :center and :orientation. You can also pass a scale, or scale-x, or scale-y, or scale-zas with a transformed-surface.

Page 227: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 221

(define-object boxed-surfaces-test (base-object)

;;bounding-box-from-points gives errors

:objects

((b-spline :type ’test-b-spline-surface)

(boxed :type ’boxed-surface

:surface-in (the b-spline))

(translated :type ’boxed-surface

:surface-in (the b-spline)

:center (translate (the center) :left 15))

(twisted :type ’boxed-surface

:surface-in (the boxed)

:orientation

(alignment :left (the (face-normal-vector :top))

:rear (rotate-vector-d (the (face-normal-vector :rear))

30

(the (face-normal-vector :top)))))

(rotated :type ’boxed-surface

:surface-in (the b-spline)

:display-controls (list :color :purple)

:orientation

(alignment :left

(rotate-vector-d (the (face-normal-vector :left))

50

(the (face-normal-vector :rear)))))

(rotated-about :type ’boxed-surface

:surface-in (the b-spline)

:display-controls (list :color :purple)

:orientation-center (translate (the center) :right 2.5)

;;:center (translate (the center) :up 5)

:orientation

(alignment :left

(rotate-vector-d (the (face-normal-vector :left))

45

(the (face-normal-vector :rear)))))

(moved-up :type ’boxed-surface

:surface-in (the rotated-about)

:center (translate (the rotated-about center)

:up 7

:left 5))

(straightened :type ’boxed-surface

:surface-in (the moved-up)

:orientation

(alignment :left

(rotate-vector-d

(the-child surface-in (face-normal-vector :left))

45

(the-child surface-in (face-normal-vector :rear)))

:rear (the-child surface-in (face-normal-vector

:rear))))

(rotated-straightened :type ’boxed-surface

:surface-in (the straightened)

:orientation (the moved-up orientation)

:orientation-center

(translate (the-child surface-in center) :up 2.5))

(rotated-straightened-moved :type ’boxed-surface

:surface-in (the rotated-straightened)

:center (translate (the-child surface-in center)

:right 5))

(center-sphere :type ’sphere

:radius 0.3

:center (the moved-up-and-straightened orientation-center))

(moved-up-and-straightened

:type ’boxed-surface

:surface-in (the straightened)

:center (translate (the-child orientation-center) :right 7)

:orientation

(alignment :left (the-child surface-in (face-normal-vector :rear))

:front

(rotate-vector-d

(the-child surface-in (face-normal-vector :left))

45

(the-child surface-in (face-normal-vector :rear))))

:orientation-center (translate (the straightened center) :up 2.5))

(moved-up-and-straightened-1

:type ’boxed-surface

:surface-in (the straightened)

:center (translate (the-child surface-in center) :right 14)

:orientation (the rotated-straightened orientation)

:orientation-center (translate (the straightened center) :up 2.5))

(moved-up-and-straightened-2

:type ’boxed-surface

:surface-in (the straightened)

:center (translate (the-child surface-in center) :right 21)

:orientation (the rotated-straightened orientation)

:orientation-center (translate (the straightened center) :up 2.5))

(transformed :type ’boxed-surface

:surface-in (the b-spline)

:center (translate (the center) :left 50)

:orientation

(alignment :rear

(rotate-vector-d (the (face-normal-vector :rear))

30

(the (face-normal-vector :right)))))))

Figure 11.79: Example Code for boxed-surface

Page 228: Genworks GDL: A User's Manual - Genworks International

222 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Input slots (required):

Surface-in GDL Surface object

This can be any type of surface, e.g. b-spline-surface, fitted-surface, or an edge from asolid brep. Note that the reference-box of this surface (i.e. its center and orientation)will have an effect on the resulting boxed-surface. If you want to consider the incomingsurface-in as being in global space, then make sure its center is (0 0 0) and its orientationis nil or equivalent to geom-base::+identity-3x3+

Input slots (optional):

Center 3D Point in global space

You can pass in a new center for the surface’s reference box, which will move the wholebox including the surface. This defaults to the orientation-center (if given), otherwiseto the (the surface-in center).

From-center 3D Point in global space

The center with respect to which this object should be positioned. Normally this shouldnot be specified by user code, unless you know what you are doing [e.g. to override thecenter of a surface-in which is meaningless and force it to be interpreted as a surface inglobal space, you could specify this as (the center) when passing it in from the parent].Default is (the surface-in orientation).

From-object GDL object which mixes in base-object

The current boxed-surface will be positioned and oriented with respect to the center andorientation of this object. The default is (the surface-in).

From-orientation 3x3 Transformation Matrix

The orientation with respect to which this object should be oriented. Normally thisshould not be specified by user code, unless you know what you are doing [e.g. to overridethe orientation of a surface-in which is meaningless and force it to be interpreted as asurface in the parent’s coordinate system, you could specify this as (the orientation)when passing it in from the parent]. Default is (the surface-in orientation).

Orientation 3x3 Transformation Matrix

This will be the new orientation for the box and the contained surface. Default is (thesurface-in orientation) – i.e. identical orientation with the provided surface-in.

Orientation-center 3D Point in global space

If you provide this, the surface’s reference box will be moved to have its center at thispoint, before any orientation is applied. This will become the new center of the resultingboxed-surface, unless you explicitly pass in a different center. Default is nil.

Scale Number

The overall scale factor for X, Y, and Z, if no individual scales are specified. Defaults to1.

Scale-x Number

The scale factor for X. Defaults to 1.

Page 229: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 223

Scale-y Number

The scale factor for Y. Defaults to 1.

Scale-z Number

The scale factor for Z. Defaults to 1.

Show-box? Boolean

This determines whether the reference box is displayed along with the surface. Defaultis nil.

Show-control-polygon? Boolean

This determines whether the control polygon is displayed along with the surface. Defaultis t (will be changed to nil).

Show-tight-box? Boolean

This determines whether the tight box is displayed along with the surface. Default isnil.

Computed slots:

Control-points List of lists of 3D Points

The control net.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

U-degree Integer

Degree of surface in U direction. Defaults to 3.

U-knot-vector List of Numbers

Knots in U direction. Default is NIL, which indicates a uniform knot vector in Udirection.

V-degree Integer

Degree of surface in V direction. Defaults to 3.

V-knot-vector List of Numbers

Knots in V direction. Default is NIL, which indicates a uniform knot vector in Vdirection.

Weights List of lists of numbers

A weight to match each control point. Should be congruent with control-points (i.e.same number of rows and columns). Default is a value of 1.0 for each weight, resultingin a nonrational surface.

Width Number

X-axis dimension of the reference box. Defaults to zero.

• brep

Mixins: geometry-kernel-object-mixin, ifs-output-mixin, base-object

Page 230: Genworks GDL: A User's Manual - Genworks International

224 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Author Dave Cooper, Genworks

Description A general superclass for all boundary representation geometric entities. Thiscurrently follows the smlib topology model, with breps containing regions, regions con-taining shells, and shells containing faces and edges. Shells which completely enclose avolume are considered to make up a solid brep.

Input slots (optional):

Brep-tolerance Number

Overall tolerance for the created brep solid. Defaults to nil. Note that a value of nilindicates for SMLib to use value of 1.0e-05 of the longest diagonal length of the brep.

Built-from GDL Brep object

Defaults to nil. Specify this if you want this brep to be a clone of an existing brep. (note- this uses a shared underlying brep object, it does not make a copy)

Face-brep-colors List of Color Keywords

These indicate the colors for the breps produced by (the face-breps). If the number offace-breps exceeds the length of this list, the colors will be repeated in order. Defaultsto a list with keys:

– :green

– :red

– :blue

– :purple-dark

– :violet

– :cyan.

Tessellation-parameters Plist of keyword symbols and numbers

This controls tessellation for this brep. The keys are as follows:

– :min-number-of-segments

– :max-3d-edge-factor

– :min-parametric-ratio

– :max-chord-height

– :max-angle-degrees

– :min-3d-edge

– :min-edge-ratio-uv

– :max-aspect-ratio

and the defaults come from the following parameters:

(list

:min-number-of-segments *tess-min-number-of-segments*

:max-3d-edge-factor *tess-max-3d-edge-factor*

:min-parametric-ratio *tess-min-parametric-ratio*

:max-chord-height *tess-max-chord-height*

Page 231: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 225

:max-angle-degrees *tess-max-angle-degrees*

:min-3d-edge *tess-min-3d-edge*

:min-edge-ratio-uv *tess-min-edge-ratio-uv*

:max-aspect-ratio *tess-max-aspect-ratio*)

Input slots (optional, settable):

Density Number

The density per unit volume of the brep. Defaults to 1

Display-iso-curves-wireframe? Boolean

Determines whether the isoparametric curves of each face of the brep are used for wire-frame display. The default is T.

Display-tessellation-lines-wireframe? Boolean

Determines whether the tessellation grid-lines of the brep are used for wireframe display.The default is NIL.

Isos Plist with keys :n-u and :n-v

The number of isoparametric curves to be displayed in each direction. This value comesfrom the value of :isos on the display-controls if that exists, and defaults to *isos-default*otherwise.

Max-3d-edge Number

Used for tessellations. Computed from (the max-extent) and (the max-3d-edge-factor).WARNING: Modify this value at your peril. Small values can cause intractable tessel-lations. It is better to tweak max-3d-edge-factor to a small value like 0.1, as this will betaken relative to the max-extent of the brep.

Max-3d-edge-factor Number

Used for tessellations. Default comes from (the tessellation-parameters).

Max-angle-degrees Number

Used for tessellations. Default comes from (the tessellation-parameters).

Max-aspect-ratio Number

Used for tessellations. Default comes from (the tessellation-parameters).

Max-chord-height Number

Used for tessellations. Default comes from (the tessellation-parameters).

Min-3d-edge Number

Used for tessellations. Default comes from (the tessellation-parameters).

Min-edge-ratio-uv Number

Used for tessellations. Default comes from (the tessellation-parameters).

Min-number-of-segments Integer

Used for tessellations. Default comes from (the tessellation-parameters).

Min-parametric-ratio Number

Used for tessellations. Default comes from (the tessellation-parameters).

Page 232: Genworks GDL: A User's Manual - Genworks International

226 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Poly-brep-smooth-results? Boolean

Smooth results for poly-brep? Defaults to t.

Computed slots:

Adaptive-tolerance Number

This is the actual tolerance stored in the SMLib object.

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Local-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding this geometric object.

Min-max-x-y-z

Triangle-data List of Plists, one for each face, format still being determined

. Contains triangle and connectivity data for the tessellation of this brep. Exact sup-ported format will be documented here when ready.

Hidden objects:

Composed-edges The composed edges contained within this brep, this is valid just if thebrep does not contain holes

Edges-sequence Sequence of GDL Edge Objects

The Edges contained within this brep aranged clockwise or anticlockwise, this is validjust if the brep does not contain holes

Poly-brep Polygonal Brep Object

This brep represented as a Polygonal Brep

Hidden objects (sequence):

Edges Sequence of GDL Edge Objects

The Edges contained within this brep.

Face-breps Sequence of GDL Brep objects

One brep for each face in the parent brep, containing only that face.

Faces Sequence of GDL Face Objects

The Faces contained within this brep.

Regions Sequence of GDL Region Objects

The Regions contained within this brep.

Shells Sequence of GDL Shell Objects

The Shells contained within this brep.

Vertices Sequence of GDL Vertex Objects

The Vertices contained within this brep.

Page 233: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 227

Gdl functions:

Area Number

Area covered by the faces of the brep.

Area-moments-of-inertia 3D Vector (i

e. 3D Point). Returns the Area Moments of Inertia of the brep.

Area-products-of-inertia 3D Vector (i

e. 3D Point). Returns the Area Products of Inertia of the brep.

Area-second-moment-about-coordinate-axii 3D Vector (i

e. 3D Point). Returns the Area Second Moment About Coordinate Axii of the brep.

Area-static-moments 3D Vector (i

e. 3D Point). Returns the Area Static Moments of the brep.

Brep-intersect? Value nil or t

This function performs an intersection between this brep and another brep. The functionreturns a NIL value if no intersection is found and T if a intersection is found.

Center-of-gravity 3D Point

Center of gravity of the mass of the brep.

In? Boolean

Returns t or nil depending on whether the point given is within the boundary of thebrep (including faces).

Mass Number

Mass represented by the brep, according to the density.

Moments Plist

Returns the moments of the brep. The plist contains keys: :area-static-moments, :area-moments-of-inertia,

Precise-properties Multiple values: Number, Number, Number, and Plist

Returns the area, volume, mass, and moments for the brep. The moments are labeledas: :area-static-moments, :area-moments-of-inertia,

Precise-properties-plist Plist with keys: :area, :volume, :mass, :moments

Returns the area, volume, mass, and moments for the brep. The moments are labeledas: :area-static-moments, :area-moments-of-inertia,

Properties Plist with keys: :area, :volume, :barycenter

Returns the approximate area, volume, and barycenter (center of mass) for the brep.These are computed with tessellation techniques, which may be less precise than theanalytic techniques used in precise-properties, but should be faster to compute andexhibit more stability.

Tessellation Plist or list

Contains tessellation data for the brep based on the values of the keyword args. This isused to produce the value of (the triangle-data).

Page 234: Genworks GDL: A User's Manual - Genworks International

228 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Volume Number

Volume enclosed by the brep.

Volume-moments-of-inertia 3D Vector (i

e. 3D Point). Returns the Volume Moments of Inertia of the brep.

Volume-products-of-inertia 3D Vector (i

e. 3D Point). Returns the Volume Products of Inertia of the brep.

Volume-second-moment-about-coordinate-axii 3D Vector (i

e. 3D Point). Returns the Volume Second Moment about Coordinate Axii of the brep.

Volume-static-moments 3D Vector (i

e. 3D Point). Returns the Volume Static Moments of the brep.

• brep-intersect

Mixins: base-object

Description This primitive takes two brep objects and attempts to intersect the faces ofthe one with the faces of the other, yielding a sequence of edges which also behave ascurves.

Input slots (required):

Brep Object of type brep

The first brep for intersecting its faces.

Other-brep Object of type brep

The other brep for intersecting faces.

Input slots (optional):

Angle-tolerance Number

Defaults to (radians-to-degrees *angle-tolerance-radians-default*).

Approximation-tolerance Number

Defaults to the max of the adaptive-tolerance of any of the input breps.

Hide-edges? Boolean

Should edges be children or hidden-children? Defaults to nil which makes them displayas children.

Hide-points? Boolean

Should points be children or hidden-children? Defaults to nil which makes them displayas children.

• cad-assembly

Mixins: base-object

Description Represents a hierarchical CAD assembly for import into GDL.

Page 235: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 229

Input slots (optional):

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

Display-controls Plist

May contain keywords and values indicating display characteristics for this object. Thefollowing keywords are recognized currently:

:color color keyword from the *color-table* parameter, or an HTML-style hexidecimalRGB string value, e.g. ”#FFFFFF” for pure white. Defaults to :black.

:line-thickness an integer, defaulting to 1, indicating relative line thickness for wire-frame representations of this object.

:dash-pattern (currently PDF/PNG/JPEG only). This is a list of two or three num-bers which indicate the length, in pixels, of the dashes and blank spaces in a dashedline. The optional third number indicates how far into the line or curve to start thedash pattern.

Imported-assembly GDL smlib:assembly-import object

Normally this should be left to its default value. Defaults to the assembly-import pro-duced from the file-name.

Orientation 3x3 Matrix of Double-Float Numbers

Indicates the absolute Rotation Matrix used to create the coordinate system of thisobject. This matrix is given in absolute terms (i.e. with respect to the root’s orientation),and is generally created with the alignment function. It should be an ıorthonormalmatrix, meaning each row is a vector with a magnitude of one (1.0).

Strings-for-display String or List of Strings

Determines how the name of objects of this type will be printed in most places. Thisdefaults to the name-for-display (generally the part’s name as specified in its parent),followed by an index number if the part is an element of a sequence.

• cardinal-spline

Mixins: curve

Author Dave Cooper, Genworks International

Description This object makes a Cardinal Spline, which defaults to a Catmull-Rom Splinefor nil tension-params (which means they all default to 0.0).

Input slots (optional):

Alpha Alpha value to control parameterization

. See parameterization input-slot for keyword equivalents. Default is 0

Parameterization Keyword symbol

uniform gives alpha 0, centripetal gives alpha 0.5, :chordal gives alpha 1. Defaultis nil, which lets alpha defer to its default, which is 0 (uniform).

Page 236: Genworks GDL: A User's Manual - Genworks International

230 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-circular-curve (circular-curve)

:computed-slots

((center (make-point 0 0 0)) (radius 10)))

(generate-sample-drawing :objects (make-object ’test-circular-curve))

Figure 11.80: Example Code for circular-curve

Figure 11.81: circular-curve example

• circular-curve

Mixins: arc-curve

Description An full circule represented exactly as a quadratic NURBS curve. Inputs andmessages are the same as for arc-curve.

• circular-surface

Mixins: trimmed-surface, vanilla-mixin

Description Represents a planar, full-circular surface controlled by a radius, and the normalcenter and orientation for base-object.

Input slots (required):

Page 237: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 231

(in-package :gdl-user)

(define-object circular-surface-test (surf::circular-surface)

:computed-slots ((radius 108)))

(generate-sample-drawing :objects (make-object ’circular-surface-test))

Figure 11.82: Example Code for circular-surface

Figure 11.83: circular-surface example

Page 238: Genworks GDL: A User's Manual - Genworks International

232 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object test-compatible-curves ()

:objects

((b-spline :type ’b-spline-curve

:control-points (list (make-point 0 0 0)

(make-point -1 0 0)

(make-point -1 1 0)

(make-point 0 1 0)))

(linear-curve :type ’linear-curve

:start (make-point 0 1 0)

:end (make-point 4 1 0))

(compatible-curves :type ’compatible-curves

:curve-list (list (the b-spline) (the linear-curve)))))

(generate-sample-drawing :object-roots (list (make-object ’test-compatible-curves)))

Figure 11.84: Example Code for compatible-curves

Radius Number

The radius of the resulting trimmed-surface.

Hidden objects:

Basis-surface GDL NURBS Surface

The underlying surface to be trimmed.

Island Single GDL NURBS Curve or list of same

These curves make up the outer trimming loop. Normally should be in counter-clockwiseorientation; if not, please specify reverse-island? as non-NIL.

• compatible-curves

Mixins: base-object

Author Dave Cooper, Genworks

Description Experimental. This primitive takes in a list of GDL curve objects and willcompute a sequence of new curve objects which have been made to be compatible interms of number of control points, knot vectors, and degree.

Input slots (optional):

Page 239: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 233

Figure 11.85: compatible-curves example

Curve-list List of GDL curve objects

.

Tolerance Tolerance is used to check knots removability for data reduction

A nil value indicates that no data reduction is to be attempted. Defaults to nil.

Objects (sequence):

Curves Sequence of GDL Curve objects

These are the resultant curves which are supposed to be compatible.

• compatible-surfaces

Mixins: base-object

Description This routine makes compatible a list of GDL surface, minimum 2 surfaces isrequired.

Input slots (required):

Surface-list List

A list of Gdl surface objects.

• composed-curve

Mixins: curve

Page 240: Genworks GDL: A User's Manual - Genworks International

234 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object compatible-surfaces-test (surface)

:computed-slots ((surface-list (list (the surf-A) (the surf-B))))

:objects

((make-compatible-A-and-B :type ’compatible-surfaces

:display-controls (list :line-thickness 2)

:surface-list (the surface-list))

(surf-A :type ’rectangular-surface

:display-controls (list :color :green-spring-medium)

:length 10

:width 10 )

(surf-B :type ’rectangular-surface

:display-controls (list :color :red)

:center (make-point 10 0 0 )

:length 10

:width 10 )))

(generate-sample-drawing :object-roots

(list (the-object (make-object ’compatible-surfaces-test)

make-compatible-A-and-B)))

Figure 11.86: Example Code for compatible-surfaces

Figure 11.87: compatible-surfaces example

Page 241: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 235

Description Creates a single NURBS curve from a list (ordered or unordered) NURBScurves. If the result is more than one curve, this object will throw an error and youshould use composed-curves instead.

Input slots (required):

Curves List of GDL curve objects

These are the curves to be composed into a single curve.

Input slots (optional):

Coincident-point-tolerance Number

Distance two curve endpoints can be apart and be considered coincident, the compositewill be built without doing anything to the endpoints. Default is 0.01. Note: Thisinput-slot must be non-zero.

Distance-to-create-line Number

Distance two curve endpoints can be apart and have a linear curve segment automaticallyadded between the points. Default is 0.1.

• composed-curves

Mixins: base-object

Description Creates multiple NURBS curves by composing a list (ordered or unordered)NURBS curves. If the result is expected to be a single curve, you may wish to usecomposed-curve instead.

Input slots (required):

Curves-in List of GDL curve objects

These are the curves to be composed into a single curve.

Input slots (optional):

Coincident-point-tolerance Number

Distance two curve endpoints can be apart and be considered coincident, the compositewill be built without doing anything to the endpoints. Default is 0.01. Note: Thisinput-slot must be non-zero.

Distance-to-create-line Number

Distance two curve endpoints can be apart and have a linear curve segment automaticallyadded between the points. Default is 0.1.

Objects (sequence):

Curves Sequence of GDL Curve Objects

The curves resulting from composition.

Page 242: Genworks GDL: A User's Manual - Genworks International

236 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object test-global-filleted-polyline-curves (global-filleted-polyline-curves)

:computed-slots

((default-radius 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0))))

:hidden-objects

((points :type ’point

:sequence (:size (length (rest (the vertex-list))))

:center (nth (the-child index) (rest (the vertex-list))))

(view :type ’base-view

:page-width (* 5 72) :page-height (* 5 72)

:objects (cons self (list-elements (the points))))))

(define-object test-composed-curve (composed-curve)

:computed-slots

((curves (the filleted-polyline-curves ordered-curves)))

:hidden-objects

((filleted-polyline-curves :type ’test-global-filleted-polyline-curves)))

(generate-sample-drawing :objects (the-object (make-object ’test-composed-curve))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.88: Example Code for composed-curve

Page 243: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 237

Figure 11.89: composed-curve example

• cone-solid

Mixins: cylinder-solid, cone

Description A right cone represented as a brep solid. Contains the union of messages (e.g.input-slots, computed-slots, etc) from brep and cone.

• conic-curve

Mixins: curve

Description A curve constructed from conic inputs. Inputs are two endpoints, two endtangents, and a point on the curve.

Input slots (required):

End-point 3D Point

End Point

End-tangent 3D Vector

End Tangent

Point-on-curve 3D Point

A point on the curve.

Start-point 3D Point

Start Point

Page 244: Genworks GDL: A User's Manual - Genworks International

238 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-cone-solid-hollow ()

:objects

((cone-solid :type ’cone-solid

:display-controls (list :isos (list :n-u 8 :n-v 8) :color :green)

:length 100

:radius-1 10

:radius-2 20

:inner-radius-1 8

:inner-radius-2 16)))

(generate-sample-drawing :object-roots (make-object ’test-cone-solid-hollow)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.90: Example Code for cone-solid

Figure 11.91: cone-solid example

Page 245: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 239

(in-package :gdl-user)

(define-object conic-curve-test (conic-curve)

:computed-slots

((start-point (make-point -10 0 0))

(start-tangent (make-point 0.1 1 0))

(end-point (make-point 10 0 0))

(end-tangent (make-point -0.1 1 0))

(point-on-curve (make-point 0 12 0))))

(generate-sample-drawing :objects (make-object ’conic-curve-test))

Figure 11.92: Example Code for conic-curve

Figure 11.93: conic-curve example

Page 246: Genworks GDL: A User's Manual - Genworks International

240 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-curve (curve)

:input-slots

((built-from (the curv-in)))

:computed-slots

((control-pts (list (make-point 3 5 1)

(make-point 5 8.0 1)

(make-point 7 10.0 1)

(make-point 8 5.0 1)

(make-point 7 0.0 1)

(make-point 5 0.0 1)

(make-point 3 5 1))))

:hidden-objects

((curv-in :type ’b-spline-curve

:control-points (the control-pts))))

(generate-sample-drawing :object-roots (make-object ’test-curve)

:projection-direction :top)

Figure 11.94: Example Code for curve

Start-tangent 3D Vector

Start Tangent

• curve

Mixins: geometry-kernel-object-mixin, base-object

Description A generalized NURBS curve. Usually used as a mixin in more specific curves.

Input slots (optional):

Built-from GDL Curve

Specify this if you want this curve to be a clone of an existing curve. (note - this uses ashared underlying curve object, it does not make a copy)

Uv-curve GDL Curve object

The corresponding UV curve for the primary surface on which this curve lies, if any. Ifthis is not a surface-curve, this will return an error.

Input slots (optional, settable):

Tolerance Number

Approximation tolerance for display purposes. Defaults to the tolerance of the built-fromcurve, if one exists, otherwise defaults to the *display-tolerance*.

Page 247: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 241

Figure 11.95: curve example

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Direction-vector 3D Vector

The direction pointing from the start to the end.

End 3D Point

The point returned by evaluating the curve function at u2.

On-surfaces List of GDL surfaces

The surfaces on which this curve lies.

Start 3D Point

The point returned by evaluating the curve function at u1.

Success? Boolean

This will be t if the curve is generated successfully, nil otherwise.

U-max Number

The highest parameter value of the underlying mathematical definition for this paramet-ric curve

U-min Number

The lowest parameter value of the underlying mathematical definition for this parametriccurve

Page 248: Genworks GDL: A User's Manual - Genworks International

242 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

U1 Number

Equal to the natural u-min of the curve.

U2 Number

Equal to the natural u-max of the curve.

Hidden objects:

First-derivative GDL Curve

The first derivative of this curve. The degree will be one less than the degree of thiscurve.

Second-derivative GDL Curve

The second derivative of this curve. The degree will be two less than the degree of thiscurve.

Gdl functions:

Acceleration 3D Vector

The given parameter evaluated on the second derivative curve of this curve. Note thatthis is only valid if this curve has degree of at least two (2), and will throw an errorotherwise.

B-spline-data List of 3D points, List of numbers, List of numbers, and integer

Returns four values which are the control points, the weights, the knots, and the degreeof the curve.

Check-continuity Either T or a plist of numbers with keys :distance, angle, :length

.

Closure Keyword symbol, :closed, :open, or :continuous

Curvature Number

The reciprocal of the radius of curvature at the given parameter.

Curve-intersection-point Surface Point

First point of intersection between this curve and the other curve given as the argument.This function also returns a second value, which is a surface point representing the endof a contiguous segment, if any, associated with the surface point given as the primaryreturn value. A NIL value as this second return value indicates that there was nocontiguous segment, only an intersecting point as indicated by the surface point givenas the primary return value.

Curve-intersection-points Surface Points

Points of intersection between this curve and another curve. This function also returnsa second value, which is a list of surface points representing the ends of contiguoussegments, if any, associated with the surface point in the same position in the primaryreturned list. NIL values in this second returned list indicate that there was no contigu-ous segment, only an intersecting point as indicated by the surface point in the primaryreturned list.

Page 249: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 243

Dropped-curve List of Plists

The returned list of plists contains information about the points where the tangents ofthis curve and those of the curve given as the argument are equal.

Dropped-point Surface Point

Given a 3D point, returns the point(s) projected normally onto the curve.

Equi-spaced-parameters List of Numbers

Returns the specified number of parameters equally spaced along the curve.

Equi-spaced-points List of 3D Points

Returns the specified number of points equally spaced along the curve.

In-plane? Boolean

Given a point and a vector defining a plane, returns T or NIL depending whether thiscurve lies in the plane. Also returns a second value which is the maximum distance ofthe curve from the plane.

Local-bounding-box Returns a bbox object, answering xmin, ymin, zmin, xmax, ymax,and zmax, for a box containing the convex hull (i.e. the control points) of this curveand oriented according to the given center and orientation.

Maximum-distance-to-curve Plist

The returned plist contains information about the maximum distance from this curve tothe curve given as the argument.

Maximum-distance-to-point Plist

The returned plist contains information about the maximum distance from this curve tothe point given as the argument.

Minimum-distance-to-curve Plist

The returned plist contains information about the minimum distance from this curve tothe curve given as the argument.

Minimum-distance-to-point Plist

The returned plist contains information about the minimum distance from this curve tothe point given as the argument.

Minimum-radius Number

The minimum radius of curvature for the curve. A second value is also returned, whichis a surface point indicating the point on the curve where this minimum radius occurs. Athird value is also returned, which is a list of additional curve parameters where similarminimum radii occur.

Normal 3D Vector

The normal of the curve at the given parameter value, i.e. the vector pointing from thepoint on the curve at this parameter to the center of the osculating circle at that point.if the curve has no curvature at the given parameter, NIL is returned.

Offset-point-along Surface point

Returns point at given parameter offset by given distance.

Page 250: Genworks GDL: A User's Manual - Genworks International

244 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

On? Boolean

Returns non-NIL if the given parameter lies within the parameter range of this curve.

Parameter-at-length Number

Returns the parameter representing a point offset from the start of the curve by thegiven length.

Parameter-at-point Number

Returns the parameter of the given point on the curve.

Parameter-bounds Numbers (multiple return values)

The minimum and maximum parameter values for this parametric curve.

Plane-intersection-point Surface Point

First point of intersection between this curve and the plane denoted by plane-point andplane-normal

Plane-intersection-points Surface Points

Points of intersection between this curve and the plane denoted by plane-point andplane-normal.

Point 3D Point

The point on the curve corresponding to the given parameter value.

Radius-of-curvature Number

The radius of curvature (i.e. radius of the osculating circle) at the given parameter.

Surface-intersection-point Surface point

Returns the first point of intersection between this curve and the surface given as anargument.

Surface-intersection-points List of Surface points

Returns the point(s) of intersection between this curve and the surface given as anargument.

Tangent 3D Vector

The curve tangent at the given parameter value. Supplementary values returned are:the 3D point at the parameter value. If keyword argument :include-curvature? isgiven as non-NIL, the radius of the osculating circle, the center for the osculating circle,the normal for the osculating circle, and the curve normal are also returned. Note:If :include-curvature? is given as non-NIL and the curve has no curvature at thespecified parameter, NIL is returned for each of these four values.

Tangent-points List of Plists

The returned list of plists contains information about the points where the tangents ofthis curve and the vector given as the argument are equal.

Total-length Number

The total length of the curve from given start-parameter to given end-parameter.

Trim GDL Curve object

Returns a curve which is trimmed from parameter-1 to parameter-2.

Page 251: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 245

(in-package :surf)

(define-object test-cone-solid (cone-solid)

:computed-slots

((display-controls (list :isos (list :n-u 8 :n-v 8) :color :green))

(length 100) (radius-1 10) (radius-2 20)))

(generate-sample-drawing :objects (the-object (make-object ’test-cone-solid))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.96: Example Code for cylinder-solid

Figure 11.97: cylinder-solid example

• cylinder-solid

Mixins: brep, cylinder

Description A right cylinder represented as a brep solid. Contains the union of messages(e.g. input-slots, computed-slots, etc) from brep and cylinder

• decomposed-curves

Mixins: base-object

Description Given an input curve, creates a sequence of curve segments that do not containknots with degree-fold mutiplicity.

Input slots (required):

Page 252: Genworks GDL: A User's Manual - Genworks International

246 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-global-filleted-polyline-curves (global-filleted-polyline-curves)

:computed-slots

((default-radius 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0))))

:hidden-objects

((points :type ’point

:sequence (:size (length (rest (the vertex-list))))

:center (nth (the-child index) (rest (the vertex-list))))))

(define-object test-composed-curve (composed-curve)

:computed-slots

((curves (the filleted-polyline-curves ordered-curves)))

:hidden-objects

((filleted-polyline-curves :type ’test-global-filleted-polyline-curves)))

(define-object test-decomposed-curves (decomposed-curves)

:computed-slots

((curve-in (the composed-curve)))

:objects ((composed-curve :type ’test-composed-curve)))

(generate-sample-drawing :object-roots (make-object ’test-decomposed-curves))

Figure 11.98: Example Code for decomposed-curves

Page 253: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 247

Figure 11.99: decomposed-curves example

Curve-in GDL Curve

Curve (presumably multi-segment) to be decomposed.

Objects (sequence):

Curves Sequence of GDL curve objects

The resulting segment curves after decomposition.

• dropped-curve

Mixins: curve

Description Creates a 3D curve which is the curve-in dropped normally to the surface..The resulting 3D curve contains a uv-curve which is typically useful for trimming.

NOTE: Change from 1577p027 and forward – the dropped curve now is a 3D curve whichcan be drawn. It contains its uv representation on the surface. Previously, the uv-curvewas the actual dropped-curve.

Input slots (required):

Curve-in GDL NURBS Curve

The curve to be dropped to the surface.

Surface GDL NURBS Surface

The surface on which the curve-in is to be dropped.

Computed slots:

Page 254: Genworks GDL: A User's Manual - Genworks International

248 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-trimmed-from-dropped-2 (trimmed-surface)

:computed-slots

((uv-inputs t)

(holes (list (the hole uv-curve)))

(island (the island-3d uv-curve))

(reverse-island? t) (reverse-holes? t)

(display-controls (list :color :blue :line-thickness 2)))

:hidden-objects

((basis-surface :type ’test-fitted-surface

:display-controls (list :color :grey-light-very)

:grid-length 10 :grid-width 10 :grid-height 5)

(island-3d :type ’dropped-curve

:curve-in (the raised-island)

:surface (the basis-surface))

(hole :type ’dropped-curve

:curve-in (the raised-hole)

:surface (the basis-surface))

(raised-hole :type ’b-spline-curve

:display-controls (list :color :grey-light-very)

:control-points (list (make-point 3.5 4.5 7)

(make-point 4.5 6 7)

(make-point 5.5 7 7)

(make-point 6 4.5 7)

(make-point 5.5 2 7)

(make-point 4.5 2 7)

(make-point 3.5 4.5 7)))

(raised-island :type ’b-spline-curve

:display-controls (list :color :grey-light-very)

:control-points (list (make-point 3 5 7)

(make-point 5 8 7)

(make-point 7 10 7)

(make-point 8 5 7)

(make-point 7 0 7)

(make-point 5 0 7)

(make-point 3 5 7)))))

(generate-sample-drawing

:objects (let ((self (make-object ’test-trimmed-from-dropped-2)))

(list (the basis-surface) self (the raised-hole)

(the raised-island)))

:projection-direction :trimetric)

Figure 11.100: Example Code for dropped-curve

Page 255: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 249

Figure 11.101: dropped-curve example

Built-from GDL Curve

Specify this if you want this curve to be a clone of an existing curve. (note - this uses ashared underlying curve object, it does not make a copy)

Hidden objects:

Uv-curve GDL Curve object

The corresponding UV curve for the primary surface on which this curve lies, if any. Ifthis is not a surface-curve, this will return an error.

• dual-blend-surface

Mixins: general-dual-blend-surface, vanilla-mixin

Description Creates a smooth blend-surface between curve-1, lying on surface-1 and curve-2 on surface-2. The local start and end directions of this surface along curve-1 andcurve-2 are determined from the cross-product between the tangent of these curves andthe corresponding surface-normal at the same point. In this fashion a tangent blend iscreated between surface-1 and surface-2 that extends in a direction perpendicular to theinput-curves. Takes the same inputs as general-dual-blend-surface, except for f-tangent-1and f-tangent-2.

Computed slots:

F-tangent-1 Input-function

Page 256: Genworks GDL: A User's Manual - Genworks International

250 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-d-b-s (base-object)

:objects

((d-b-s :type ’dual-blend-surface

:display-controls (list :color :green)

:pass-down (curve-1 surface-1 curve-2 surface-2))

(surf-1-top :type ’linear-curve

:hidden? t

:start (make-point -5 -5 0)

:end (make-point 5 -5 0))

(surf-1-bottom :type ’linear-curve

:hidden? t

:start (make-point -7 -10 -2)

:end (make-point 7 -10 -2))

(surface-1 :type ’ruled-surface

:curve-1 (the surf-1-top)

:curve-2 (the surf-1-bottom))

(curve-1 :type ’iso-curve

:display-controls (list :color :red :line-thickness 4)

:surface (the surface-1)

:parameter 0

:u-or-v :v)

(surf-2-bottom :type ’linear-curve

:hidden? t

:start (make-point -5 5 0)

:end (make-point 5 5 0))

(surf-2-top :type ’linear-curve

:hidden? t

:start (make-point -7 10 2)

:end (make-point 7 10 2))

(surface-2 :type ’ruled-surface

:curve-1 (the surf-2-bottom)

:curve-2 (the surf-2-top))

(curve-2 :type ’iso-curve

:display-controls (list :color :blue :line-thickness 4)

:surface (the surface-2)

:parameter 0

:u-or-v :v)))

(generate-sample-drawing :object-roots (list (make-object ’test-d-b-s))

:projection-direction (getf *standard-views* :top))

Figure 11.102: Example Code for surf::dual-blend-surface

Page 257: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 251

Figure 11.103: surf::dual-blend-surface example

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-1. The input value of 0 corresponds to the start of curve-1, 1 to theend of curve-1.

F-tangent-2 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-2. The input value of 0 corresponds to the start of curve-2, 1 to theend of curve-2.

• edge

Mixins: curve

Description Represents one edge in a brep. This object is a type of curve and answers allcurve messages.

Computed slots:

Faces List of GDL Face objects

The faces connected to this edge.

Gdl functions:

Uv-curve GDL Curve object

This represents the UV curve for this edge on the given surface. Note that you have topass in the surface, which should be the basis-surface of a face connected to this edge.The GDL edge object will be supplemented with a sequence of faces which are connectedwith this edge.

Page 258: Genworks GDL: A User's Manual - Genworks International

252 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• edge-blend-surface

Mixins: general-dual-blend-surface, vanilla-mixin

Description Creates a smooth blend-surface between curve-1, lying on surface-1 and curve-2 on surface-2.

Note that curve-1 and curve-2 have to be so-called on-surface curves, which means theymust answer a uv-curve message which is the UV representation of the curve on the givensurface. The most common way to establish an on-surface curve is to use an iso-curveto begin with, or to use a projected-curve or dropped-curve to ensure that the curve isindeed an on-surface curve.

The local start and end directions of this surface at any point along curve-1 and curve-2are determined from the cross-product between the tangent to the surface’s u- or v-iso-curve (the one that is closest to being parallel to curve-1 or curve-2) at this point andthe corresponding surface-normal at the same point. In this fashion a tangent blendis created between surface-1 and surface-2 that extends in a direction that follows andsmoothly interpolates both surface’s iso-curves. Takes the same inputs as general-dual-blend-surface, except for f-tangent-1 and f-tangent-2.

Input slots (optional):

Curve-1-uv GDL UV curve object

Defaults to the curve-1 uv-curve.

Curve-2-uv GDL UV curve object

Defaults to the curve-2 uv-curve.

Curve-side-1 Keyword

Used to specify the side w.r.t curve-1 in which the tangent blend-surface is to extend.Takes either :right-side or :left-side as input. Defaults to :right-side.

Curve-side-2 Keyword

Used to specify the side w.r.t curve-2 in which the tangent blend-surface is to extend.Takes either :right-side or :left-side as input. Defaults to :right-side.

Computed slots:

F-tangent-1 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-1. The input value of 0 corresponds to the start of curve-1, 1 to theend of curve-1.

F-tangent-2 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-2. The input value of 0 corresponds to the start of curve-2, 1 to theend of curve-2.

• elliptical-curve

Mixins: curve, ellipse

Page 259: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 253

(in-package :surf)

(define-object test-e-b-s (base-object)

:objects

((e-b-s :type ’edge-blend-surface

:display-controls (list :color :green)

:curve-side-1 :left-side

:curve-side-2 :left-side

:pass-down (curve-1 surface-1 curve-2 surface-2))

(surf-1-top :type ’linear-curve

:hidden? t

:start (make-point -5 -5 0)

:end (make-point 5 -5 0))

(surf-1-bottom :type ’linear-curve

:hidden? t

:start (make-point -7 -10 -2)

:end (make-point 7 -10 -2))

(surface-1 :type ’ruled-surface

:curve-1 (the surf-1-top)

:curve-2 (the surf-1-bottom))

(curve-1 :type ’iso-curve

:display-controls (list :color :red :line-thickness 4)

:surface (the surface-1)

:parameter 0

:u-or-v :v)

(surf-2-bottom :type ’linear-curve

:hidden? t

:start (make-point -5 5 0)

:end (make-point 5 5 0))

(surf-2-top :type ’linear-curve

:hidden? t

:start (make-point -7 10 2)

:end (make-point 7 10 2))

(surface-2 :type ’ruled-surface

:curve-1 (the surf-2-bottom)

:curve-2 (the surf-2-top))

(curve-2 :type ’iso-curve

:display-controls (list :color :blue :line-thickness 4)

:surface (the surface-2)

:parameter 0

:u-or-v :v)))

(generate-sample-drawing :object-roots (list (make-object ’test-e-b-s))

:projection-direction (getf *standard-views* :top))

Figure 11.104: Example Code for edge-blend-surface

Page 260: Genworks GDL: A User's Manual - Genworks International

254 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.105: edge-blend-surface example

Description An ellipse represented exactly as a quintic NURBS curve. Inputs are the sameas for ellipse. Messages are the union of those for ellipse and those for curve.

• extended-curve

Mixins: curve

Description Creates an extended curve extending its start or end (u1 and u2).

Input slots (required):

Curve-in GDL Curve Object

The underlying curve from which to build this curve.

Input slots (optional):

Continuity Keyword

Specified the extention continuity. If :g1 the curve is extended by a linear segment.Curve-in is at least G1(possibly C1) where the extension joins the original curve. If :g2the curve is extended by reflection, yielding a G2 continuous extension. If :cmax theextension yields infinite(C) continuity at the join point(no knot there). Defaults to the:g2.

Distance Number

Specified the distance to which the curve is extended.

Page 261: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 255

(in-package :surf)

(define-object test-elliptical-curve (elliptical-curve)

:computed-slots

((center (make-point 0 0 0))

(major-axis-length 10)

(minor-axis-length 5)

(start-angle 0)

(end-angle 2pi)))

(generate-sample-drawing :objects (make-object ’test-elliptical-curve))

Figure 11.106: Example Code for elliptical-curve

Figure 11.107: elliptical-curve example

Page 262: Genworks GDL: A User's Manual - Genworks International

256 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object test-extended-curve ()

:objects

((b-spline-curve :type ’b-spline-curve

:display-controls (list :color :black :line-thickness 3.0)

:control-points (list (make-point -2.0 0.0 0.0)

(make-point 0.0 1.0 0.0)

(make-point 1.0 0.0 0.0)

(make-point 0.0 -1.0 0.0)))

(extended-curve-G1 :type ’extended-curve

:curve-in (the b-spline-curve)

:distance 2.5

:distance-type :absolute

:extending-from :start

:continuity :g1

:display-controls (list :color :red))

(extended-curve-G2 :type ’extended-curve

:curve-in (the b-spline-curve)

:distance 2.5

:distance-type :absolute

:extending-from :start

:continuity :g2

:display-controls (list :color :green))

(extended-curve-Cmax :type ’extended-curve

:curve-in (the b-spline-curve)

:distance 2.5

:distance-type :absolute

:extending-from :start

:continuity :cmax

:display-controls (list :color :blue))))

(generate-sample-drawing :object-roots (make-object ’test-extended-curve))

Figure 11.108: Example Code for extended-curve

Page 263: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 257

Figure 11.109: extended-curve example

Distance-type Keyword

Specified if the distance is an absolute distance :absolute or the distance is scaled bythe curve’s arc length to yield the desired extension distance :relative. Defaults tothe :absolute.

Extending-from Keyword

Specified from which end the curve to be extended. If :start the curve is extendedback from its start point. If :end the the curve is extended forward from its end point.Defaults to the :start.

• extended-surface

Mixins: surface

Description Extends a surface to a curve, so that curve will become one of the new bound-aries for the surface. Continuity is controlled via options. Note that in the example,extended and extended-2 do not give a smooth transition to the extended part of thesurface because the original surface is only degree 1 in the direction of extension.

Input slots (required):

Curve GDL curve object

The curve to which the surface should be extended.

Surface GDL surface object

The surface to be extended.

Input slots (optional):

Page 264: Genworks GDL: A User's Manual - Genworks International

258 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object extended-surface-test (base-object)

:computed-slots

((regression-test-data (list (multiple-value-list (the extended b-spline-data))

(multiple-value-list (the extended-2 b-spline-data))

(multiple-value-list (the extended-3 b-spline-data))

(multiple-value-list (the extended-4 b-spline-data))))

(display-list-objects (list (the loft)

(the extended)

(the extended-2))))

:objects

((test3 :type ’linear-curve

:start (make-point 0 0 0)

:end (make-point 10 0 0))

(test4 :type ’linear-curve

:start (make-point 0 10 0)

:end (make-point 10 10 0))

(mid-1 :type ’linear-curve

:start (make-point 0 5.0 1)

:end (make-point 10 5.0 1))

(mid-2 :type ’linear-curve

:start (make-point 0 8.0 1)

:end (make-point 10 8.0 1))

(bridge-1 :type ’b-spline-curve

:control-points (list (make-point 0 0 0)

(make-point -2 5.0 3)

(make-point -2 8.0 3)

(make-point 0 10 0)))

(bridge-2 :type ’b-spline-curve

:control-points (list (make-point 10 0 0)

(make-point 12 5.0 5)

(make-point 12 8.0 5)

(make-point 10 10 0)))

(bridge-3 :type ’b-spline-curve

:control-points (list (make-point 0 -1 0)

(make-point 3 -1 5)

(make-point 7 -1 5)

(make-point 10 -1 0)))

(loft :type ’lofted-surface

:curves (list (the test3) (the mid-1)

(the mid-2) (the test4)))

(extended :type ’extended-surface

:display-controls (list :color :red :line-thickness 2)

:surface (the loft)

:curve (the bridge-1)

:direction :v

:which-end :start)

(extended-2 :type ’extended-surface

:display-controls (list :color :green :line-thickness 2)

:surface (the loft)

:curve (the bridge-1)

:direction :v

:which-end :start

:deformation-param (+ (* 0.25 (- (the-child surface v-max)

(the-child surface v-min)))

(the-child surface u-min)))

(extended-3 :type ’extended-surface

:display-controls (list :color :orange

:isos (list :n-u 25 :n-v 25))

:surface (the loft)

:curve (the bridge-3)

:direction :u

:continuity :cmax

:which-end :start)

(extended-4 :type ’extended-surface

:display-controls (list :color :blue

:isos (list :n-u 25 :n-v 25))

:surface (the loft)

:curve (the bridge-3)

:direction :u

:deformation-param (+ (* 0.25 (- (the-child surface u-max)

(the-child surface u-min)))

(the-child surface u-min))

:continuity :cmax

:which-end :start)))

(generate-sample-drawing :objects (the-object (make-object ’extended-surface-test)

display-list-objects)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.110: Example Code for extended-surface

Page 265: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 259

Figure 11.111: extended-surface example

Continuity Keyword symbol, if deformation-param is given this can be one of :c1, :c2, or:cmax, and if deformation-param is not given this can be one of :g1 or :cmax. Defaultis :c1 if deformation-param is given and :g1 if deformation-param is not given.

Deformation-param Number, either a U or a V surface parameter

This value, if given, controls how far inward from the affected boundary the surface ismodified. If (the direction) is :u, then this will be a U parameter, and likewise if (thedirection) is :v, then this will be a V parameter. Default is nil which indicates no specificcontrol over any deformation.

Direction Keyword symbol, one of :u or :v

The direction of extension. Note that if deformation-param is given, it will be a Uparameter if this input :u, and a V parameter if this input is :v. Default is :u.

Which-end Keyword symbol, one of :start or :end

Default is :start.

• extruded-solid

Mixins: brep

Description Generates a brep by extruding a profile along an axis vector.

Input slots (required):

Profile GDL Curve object

The profile to be extruded into a solid.

Page 266: Genworks GDL: A User's Manual - Genworks International

260 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Input slots (optional):

Axis-vector 3D Vector

The direction of extrusion. Defaults to (the (face-normal-vector :top))

Brep-tolerance Number

Overall tolerance for the created brep solid. Defaults to nil. Note that a value of nilindicates for SMLib a value of 1.0e-05 of the longest diagonal length of the brep.

Distance Number

The distance to extrude the profile along the axis-vector. Defaults to (the height).

• face

Mixins: surface

Description This object represents a (possibly) trimmed surface contained within a brep.It answers all the local messages of face, and it has surface mixed in as well, so itwill answer all the surface messages. Note however that the local surface messages willoperate on the basis, not on the trimmed representation. The messages for face willoperate on the trimmed representation.

This object is not meant for direct instantiation; rather, a brep will contain a quantifiedset of faces (called ”faces”), and trimmed surface also mixes in face, so a trimmed-surfacewill answer all the face messages.

Input slots (required):

Brep GDL Brep object

This is the brep object which contains this face object.

Input slots (optional):

Basis-surface GDL NURBS Surface

The underlying surface, before any trimming takes place.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

U-iso-curves Sequence of curve objects

The isoparametric curves in the U direction.

V-iso-curves Sequence of curve objects

The isoparametric curves in the V direction.

Hidden objects (sequence):

Page 267: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 261

Edges Sequence of GDL Edge Objects

The Edges contained within this brep.

Gdl functions:

Area Number

Returns the area of the face.

Area-moments-of-inertia 3D Vector (ie 3D Point)

Returns the Area Moments of Inertia of the face.

Area-products-of-inertia 3D Vector (ie 3D Point)

Returns the Area Products of Inertia of the face.

Area-second-moment-about-coordinate-axii 3D Vector (ie 3D Point)

Returns the Area Second Moment About Coordinate Axii of the face.

Area-static-moments 3D Vector (ie 3D Point)

Returns the Area Static Moments of the face.

Moments Plist

Returns the moments of the face. The plist contains keys: :area-static-moments, :area-moments-of-inertia, :area-products-of-inertia, :area-second-moment-about-coordinate-axii,:volume-static-moments, :volume-moments-of-inertia, :volume-products-of-inertia, and:volume-second-moment-about-coordinate-axii.

Precise-properties Multiple values: Number, Number, and Plist

Returns the area, volume, and moments of the face. The moments are labeled as::area-static-moments, :area-moments-of-inertia, :area-products-of-inertia, :area-second-moment-about-coordinate-axii, :volume-static-moments, :volume-moments-of-inertia, :volume-products-of-inertia, and :volume-second-moment-about-coordinate-axii.

Volume Number

Returns the volume of the face.

Volume-moments-of-inertia 3D Vector (ie 3D Point)

Returns the Volume Moments of Inertia of the face.

Volume-products-of-inertia 3D Vector (ie 3D Point)

Returns the Volume Products of Inertia of the face.

Volume-second-moment-about-coordinate-axii 3D Vector (ie 3D Point)

Returns the Volume Second Moment about Coordinate Axii of the face.

Volume-static-moments 3D Vector (ie 3D Point)

Returns the Volume Static Moments of the face.

• fitted-curve

Mixins: curve

Description Fits a curve through a set of points with given degree and parameterization.

Page 268: Genworks GDL: A User's Manual - Genworks International

262 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-fitted-curve (fitted-curve)

:computed-slots

((points (the circle (equi-spaced-points 20))))

:hidden-objects ((circle :type ’circle :radius 10)

(spheres :type ’sphere

:sequence (:size (length (the points)))

:radius 0.2

:center (nth (the-child :index) (the points))

:display-controls (list :color :blue-neon))))

(generate-sample-drawing :objects (let ((self (make-object ’test-fitted-curve)))

(cons self (list-elements (the spheres)))))

Figure 11.112: Example Code for fitted-curve

Figure 11.113: fitted-curve example

Page 269: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 263

Input slots (required):

Points List of 3D Points

The points for fitting.

Input slots (optional):

Degree Integer

The desired degree of the resultant curve. Default is 3, unless there are fewer than fourcontrol point given, in which case it one less than the number of control points.

Interpolant? Boolean

Indicates whether the curve will interpolate the points. Defaults to T .

Local? Boolean

Indicates whether the inputted control-points should be considered in local coordinatesystem of this object. Default is nil.

Parameterization Keyword symbol, one of :uniform, :chord-length, :centripetal

The parameterization to use in the resultant curve. Default is :centripetal. Note that theNLib documentation states that when specifying vectors and a vector-type of :tangentsor :first-last, :chord-length is a recommended value for parameterization. If vec-tors are used and the vector-type is :normals, this input has no effect. The default is:chord-length

Tolerance Number or nil

The allowed tolerance for doing data reduction after the initial fitting. A nil valueindicates that no data reduction is to be attempted. Defaults to nil.

Vector-type Keyword symbol, one of :tangents, :normals, or :first-last

:Tangents indicates that the :vectors specify a tangent vector at each point (thereshould be one vector for each point), :normals indicates that the :vectors specify anormal vector at each point (there should be one vector for each point), and :first-last

indicates that the :vectors specify the starting and ending tangent (in this case thereshould be two vectors in the :vectors list. Default is :tangents.)

Vectors List of 3D Vectors

Optional list of vectors used to influence the fitting. Default is NIL.

• fitted-surface

Mixins: surface

Description Fits a surface through a net of points with given degrees and parameteriza-tions. Currently only interpolated surfaces are supported, this will be extended to allowsmooth fitting without the surface necessarily interpolating (going through) each of thepoints.

Input slots (required):

Page 270: Genworks GDL: A User's Manual - Genworks International

264 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object c11-test (surface)

:input-slots ()

:computed-slots ()

:objects

((surf-test :type ’fitted-surface

:hidden nil

:c11? t

:points (list (list (make-point -1 0 0)

(make-point 0 0 0)

(make-point 0.001 0.0 0)

(make-point 1 1 0)

(make-point 1.001 1 0)

(make-point 2 1 0)

(make-point 2.001 1 0)

(make-point 3 2 0)

(make-point 3.001 2.001 0)

(make-point 4 3 0)

(make-point 5 4 0))

(list

(make-point -1 0 1)

(make-point 0 0 1)

(make-point 0.001 0.0 1)

(make-point 1 1 1)

(make-point 1.001 1 1)

(make-point 2 1 1)

(make-point 2.001 1 1)

(make-point 3 2 1)

(make-point 3.001 2.001 1)

(make-point 4 3 1)

(make-point 5 4 1))))))

(define-object test-fitted-surface (fitted-surface)

:input-slots

((display-controls (list :color :green-spring :isos (list :n-v 19 :n-u 19)))

(grid-width 4 :settable) (grid-length 4 :settable) (grid-height 4 :settable))

:computed-slots

((points (list (list (make-point 0 0 0)

(make-point (/ (the grid-width) 4) 0 0)

(make-point (half (the grid-width)) 0 0)

(make-point (* 3/4 (the grid-width)) 0 0)

(make-point (the grid-width) 0 0))

(list (make-point 0 (/ (the grid-length) 4) 0)

(make-point (/ (the grid-width) 4)

(/ (the grid-length) 4)

(/ (the grid-height) 4))

(make-point (half (the grid-width))

(/ (the grid-length) 4)

(* (/ (the grid-height) 4) 1.6))

(make-point (* 3/4 (the grid-width))

(/ (the grid-length) 4)

(/ (the grid-height) 4))

(make-point (the grid-width)

(/ (the grid-length) 4) 0))

(list (make-point 0 (half (the grid-length)) 0)

(make-point (/ (the grid-width) 4)

(half (the grid-length))

(* (/ (the grid-height) 4) 1.8))

(make-point (half (the grid-width))

(half (the grid-length))

(the grid-height))

(make-point (* 3/4 (the grid-width))

(half (the grid-length))

(* 3/4 (the grid-height)))

(make-point (the grid-width) (half (the grid-length)) 0))

(list (make-point 0 (* 3/4 (the grid-length)) 0)

(make-point (/ (the grid-width) 4)

(* 3/4 (the grid-length))

(min (* (/ (the grid-height) 4)

(* (/ (the grid-height) 4) 1.4))

(the grid-height)))

(make-point (half (the grid-width))

(* 3/4 (the grid-length))

(min (* (/ (the grid-height) 4)

(* (/ (the grid-height) 4) 1.8))

(the grid-height)))

(make-point (* 3/4 (the grid-width))

(* 3/4 (the grid-length))

(/ (the grid-height) 4))

(make-point (the grid-width)

(* 3/4 (the grid-length)) 0))

(list (make-point 0 (the grid-length) 0)

(make-point (/ (the grid-width) 4) (the grid-length) 0)

(make-point (half (the grid-width)) (the grid-length) 0)

(make-point (* 3/4 (the grid-width)) (the grid-length) 0)

(make-point (the grid-width) (the grid-length) 0))))))

(generate-sample-drawing :objects (make-object ’test-fitted-surface)

:projection-direction :trimetric)

Figure 11.114: Example Code for fitted-surface

Page 271: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 265

Figure 11.115: fitted-surface example

Points List of lists of 3D Points

The points for fitting, with inner lists representing U direction and outer lists V direction.

Input slots (optional):

C11? Boolean

If interpolated, indicates whether to compute a C11 continuous nonrational bicubicNURBS surface. Defaults to nil.

Interpolant? Boolean

Indicates whether the surface will interpolate the points. Defaults to t.

Normals List of 3D vectors of same length as points, or nil

If given, these are the surface normals at each point.

Parameterization Keyword symbol, one of :uniform, :chord-length, :centripetal

The parameterization to use in the resultant surface if interpolant? is t. Default is:chord-length

Tangent-method Keyword symbol, one of :bessel, :akima

The method used to compute tangents. Defaults to :akima.

Tolerance Number

Tolerance for fit. Defaults to *3d-approximation-tolerance-default*.

U-degree Integer

The desired degree of the resultant surface in the U direction. Default is 3.

U-start Integer

The starting degree for the fit algorithm in the U direction. Default is 1.

Page 272: Genworks GDL: A User's Manual - Genworks International

266 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

V-degree Integer

The desired degree of the resultant surface in the V direction. Default is 3.

V-start Integer

The starting degree for the fit algorithm in the V direction. Default is 1.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

• general-dual-blend-surface

Mixins: b-spline-surface

Description Creates a smooth blend-surface between curve-1, lying on surface-1 and curve-2 on surface-2. The local start and end directions of this surface along curve-1 and curve-2are specified by the user with parametric functions.

Input slots (required):

Curve-1 GDL curve

Curve lying on surface-1 that forms the starting-edge of the blend-surface

Curve-2 GDL curve

Curve lying on surface-2 that forms the ending-edge of the blend-surface

F-tangent-1 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-1. The input value of 0 corresponds to the start of curve-1, 1 to theend of curve-1.

F-tangent-2 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local directionvector along curve-2. The input value of 0 corresponds to the start of curve-2, 1 to theend of curve-2.

Surface-1 GDL surface

Surface that is to be connected to surface-2 by the blend-surface

Surface-2 GDL surface

Surface that is to be connected to surface-1 by the blend-surface

Input slots (optional):

F-ratio-1 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local blend-ratio along curve-1. The input value of 0 corresponds to the start of curve-1, 1 to theend of curve-1. The output local blend-ratio can be any number greater than 0, butthe resulting blend surface can become erratic for values greater than 1. Defaults to aconstant value of 1/3.

Page 273: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 267

(in-package :surf)

(define-object test-g-d-b-s (base-object)

:computed-slots

((f-tangent-1 #’(lambda(param)

(rotate-vector-d

(the (face-normal-vector :top))

-10

(the curve-1 (tangent param)))))

(f-tangent-2 #’(lambda(param)

(rotate-vector-d

(the (face-normal-vector :bottom))

10

(the curve-2 (tangent param)))))

(f-ratio-1 #’(lambda(param)

(declare (ignore param))

1/3))

(f-ratio-2 #’(lambda(param)

(declare (ignore param))

1/3)))

:objects

((g-d-b-s :type ’general-dual-blend-surface

:display-controls (list :color :green)

:pass-down (f-tangent-1

f-tangent-2 f-ratio-1 f-ratio-2

curve-1 surface-1 curve-2 surface-2))

(surf-1-top :type ’linear-curve

:hidden? t

:start (make-point -5 -5 0)

:end (make-point 5 -5 0))

(surf-1-bottom :type ’linear-curve

:hidden? t

:start (make-point -7 -10 -2)

:end (make-point 7 -10 -2))

(surface-1 :type ’ruled-surface

:curve-1 (the surf-1-top)

:curve-2 (the surf-1-bottom))

(curve-1 :type ’iso-curve

:display-controls (list :color :red :line-thickness 4)

:surface (the surface-1)

:parameter 0

:u-or-v :v)

(surf-2-bottom :type ’linear-curve

:hidden? t

:start (make-point -5 5 0)

:end (make-point 5 5 0))

(surf-2-top :type ’linear-curve

:hidden? t

:start (make-point -7 10 2)

:end (make-point 7 10 2))

(surface-2 :type ’ruled-surface

:curve-1 (the surf-2-bottom)

:curve-2 (the surf-2-top))

(curve-2 :type ’iso-curve

:display-controls (list :color :blue :line-thickness 4)

:surface (the surface-2)

:parameter 0

:u-or-v :v)))

(generate-sample-drawing :object-roots (list (make-object ’test-g-d-b-s))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.116: Example Code for surf::general-dual-blend-surface

Page 274: Genworks GDL: A User's Manual - Genworks International

268 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.117: surf::general-dual-blend-surface example

F-ratio-2 Input-function

Parametric function defined from 0 to 1 that outputs the blend-surface’s local blend-ratio along curve-2. The input value of 0 corresponds to the start of curve-2, 1 to theend of curve-2. The output local blend-ratio can be any number greater than 0, butthe resulting blend surface can become erratic for values greater than 1. Defaults to aconstant value of 1/3.

N-segments Number

Number of b-spline-segments of the resulting blend-surface in the parametric directionalong curve-1 and curve-2. Defaults to 50.

Computed slots:

Control-points List of lists of 3D Points

The control net.

U-degree Integer

Degree of surface in U direction. Defaults to 3.

U-knot-vector List of Numbers

Knots in U direction. Default is NIL, which indicates a uniform knot vector in Udirection.

V-degree Integer

Degree of surface in V direction. Defaults to 3.

• geometry-kernel-object-mixin

Mixins: vanilla-mixin

Page 275: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 269

Description This mixin provides messages common to all NURBS-based objects whoseunderlying implementation comes from a modular geometry kernel such as SMLib.

Input slots (optional):

Color-decimal Vector of three real numbers

The RGB color of this object as imported from an external format (e.g. IGES) or as spec-ified in :display-controls. Defaults to the foreground color specified in *colors-default*.This message should not normally be overridden in user application code.

Iges-level Integer

Synonym for the layer.

Layer Integer

The primary IGES-compatible level (layer) on which this object resides. Defaults to thefirst of the levels. This slot can be overridden in user code to specify a new layer whichwill be written out when this object is exported with the IGES output-format.

Levels List of integers

The IGES-compatible levels (layers) on which this object resides. GDL does not cur-rently support writing out multiple levels (layers) through the IGES writer ; only thefirst of these will be output if the object is exported with the IGES output-format (pleasecontact Genworks if you need all levels (layers) to be written out).

• global-filleted-polyline-curve

Mixins: global-filleted-polyline-curves, composed-curve

Description Provides a singular composed curve made from a global-filleted-polyline-curvesobject

Computed slots:

Curves List of GDL curve objects

These are the curves to be composed into a single curve.

• global-filleted-polyline-curves

Mixins: global-filleted-polyline

Description Produces a list of linear-curves and arc-curves which represent the straightsections and fillets of a global-filleted-polyline. Note also global-filleted-polyline-curve,which composes the segments together into a single curve.

Computed slots:

Ordered-curves List of GDL NURBS curve objects

The curve segments in the right order for chaining together.

Hidden objects (sequence):

Page 276: Genworks GDL: A User's Manual - Genworks International

270 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object test-global-filleted-polyline-curves (global-filleted-polyline-curves)

:computed-slots

((default-radius 5)

(vertex-list (list (make-point 0 0 0)

(make-point 10 10 0)

(make-point 30 10 0)

(make-point 40 0 0)

(make-point 30 -10 0)

(make-point 10 -10 0)

(make-point 0 0 0))))

:hidden-objects

((points :type ’point

:sequence (:size (length (rest (the vertex-list))))

:center (nth (the-child index) (rest (the vertex-list))))

(view :type ’base-view

:page-width (* 5 72) :page-height (* 5 72)

:objects (cons self (list-elements (the points))))))

(generate-sample-drawing :objects (the-object (make-object ’test-global-filleted-polyline-curves))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.118: Example Code for global-filleted-polyline-curves

Figure 11.119: global-filleted-polyline-curves example

Page 277: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 271

Fillet-curves GDL Sequence of GDL NURBS curve objects

The arc-curves representing the fillets.

Straight-curves GDL Sequence of GDL NURBS curve objects

The linear-curves representing the straights.

• iges-reader

Mixins: base-object

Description This object will reflect the contents of an iges file containing points, curves,surfaces, and/or breps (including trimmed surfaces) as sequences of GDL objects.

The HarmonyWare reader creates a log file in a temporary directory. The location ofthis log file is printed on the console during the reading operation. Currently this logfile is not automatically deleted, and its name is determined by the system.

Input slots (required):

File-name String or pathname

The location of the IGES file to be read.

Input slots (optional):

Group-trimmed-surfaces-into-brep? Boolean

If true, group all trimmed surfaces in the file into one B-rep. If some trimmed surfacesare blanked, they are grouped into a second, blanked B-rep. Default is nil.

Make-all-surfaces-trimmed? Boolean

If true, treat all untrimmed surfaces in the file as if they are trimmed surfaces withthe natural outer boundary of the surface as the trimming loop. If used, no standaloneIwSurface surface objects will ever be returned by the reader. Default is nil.

Make-single-brep? Boolean

If true, group all trimmed surfaces and B-reps in the file into one B-rep. If some trimmedsurfaces or B-reps are blanked, they are grouped into a second, blanked B-rep. Defaultis nil.

Sew-brep-faces? Boolean

Indicates whether each resulting brep should have its faces sewn together. Default is(the make-single-brep?).

Objects (sequence):

Breps Sequence of GDL brep objects

The breps and trimmed surfaces (represented as breps) found in the IGES file.

Curves Sequence of GDL curve objects

The curves found in the IGES file.

Page 278: Genworks GDL: A User's Manual - Genworks International

272 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object iso-curve-example (base-object)

:computed-slots

((parameter 0.5))

:objects

((surface :type ’surf::test-b-spline-surface)

(iso-curve :type ’iso-curve

:strings-for-display "Iso at 0.5"

:display-controls (list :color :red :line-thickness 3)

:surface (the surface)

:parameter (the parameter))))

(generate-sample-drawing :object-roots (list (make-object ’iso-curve-example))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.120: Example Code for iso-curve

Points Sequence of GDL point objects

The points found in the IGES file.

Surfaces Sequence of GDL surface objects

The untrimmed “standalone” surfaces found in the IGES file.

• intersected-solid

Mixins: boolean-merge, vanilla-mixin

Description Given two brep solids, performs the intersect Boolean between the brep andthe other-brep

• iso-curve

Mixins: curve

Description Represents an exact iso curve on the given surface in given direction at givenparameter value.

Input slots (required):

Parameter Number

The u or v will be fixed at this value. This should be between the min and max valuesfor the surface in the given direction. Note that you can check the min and max for asurface with (the u-min), (the u-max), (the v-min), or (the v-max).

Page 279: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 273

Figure 11.121: iso-curve example

Surface GDL object of type surface

The surface on which you want an iso curve.

Input slots (optional):

Fixed-parameter Keyword symbol, one of :u or :v

This is the parameter direction which will be fixed to the parameter value given. Defaultis :u.

U-or-v Keyword symbol, one of :u or :v

This is the direction of the iso-curve. The other parameter will be fixed on the surfaceat the given parameter value.

Computed slots:

On-surfaces List of GDL surfaces

For iso curve, this will contain the single surface on which the iso curve lies.

Hidden objects:

Uv-curve

• joined-surfaces

Mixins: surface

Page 280: Genworks GDL: A User's Manual - Genworks International

274 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object join-surfaces-test (base-object)

:computed-slots ((surface-list (list (the surf-A) (the surf-B))))

:objects

((surf-A :type ’rectangular-surface

:display-controls (list :color :green-spring-medium)

:length 10

:width 10 )

(surf-B :type ’rectangular-surface

:display-controls (list :color :red)

:center (make-point 10 0 0 )

:length 10

:width 10 )

(join-A-and-B :type ’joined-surfaces

:display-controls (list :line-thickness 2)

:surface (the surf-A)

:other-surface (the surf-B))))

(generate-sample-drawing :object-roots

(list (the-object (make-object ’join-surfaces-test)

join-A-and-B)))

Figure 11.122: Example Code for joined-surfaces

Description This routine joins two surfaces at a common boundary. The surfaces mustalready be compatible in the direction of the common boundary (same knots). If thesurfaces are not compatible you can use first compatible-surfaces if applicable

Input slots (required):

Other-surface Gdl surface object

The second surface to be joined . Its u-min or v-min lays at the common boundary.

Surface Gdl surface object

The first surface to be joined. Its u-max or v-max lays at the common boundary.

Input slots (optional):

Direction Keyword symbol, one of :u or :v

If :u the common boundary is for first surface u-max and for the second surface u-min.Surfaces must already be compatible in the u-direction. If :v the common boundary

Page 281: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 275

Figure 11.123: joined-surfaces example

(in-package :surf)

(define-object test-linear-curve (linear-curve)

:computed-slots ((start (make-point 0 0 0)) (end (make-point 10 10 0))))

(generate-sample-drawing :objects (make-object ’test-linear-curve))

Figure 11.124: Example Code for linear-curve

is for first surface v-max and for the second surface v-min. Surfaces must already becompatible in the v-direction. Default is :u.

Tolerance Number

This is a tolerance used for Knot removal. The knot corresponding to the mergedboundary has multiplicity equal to the degree. Knot removal will be attempted usingthis tolerance. Default is *3d-tolerance-default*

• linear-curve

Mixins: %linear-curve%, vanilla-mixin

Description A GDL NURBS Curve representing a straight line segment. The inputs arethe same as for l-line, namely start and end (3d points).

Input slots (optional):

Page 282: Genworks GDL: A User's Manual - Genworks International

276 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.125: linear-curve example

End 3D Point

The end point of the line, in global coordinates.

Start 3D Point

The start point of the line, in global coordinates.

• lofted-surface

Mixins: surface

Description Loft of a surface through a list of curves with various controls.

Input slots (required):

Curves List of GDL Curve objects

The curves through which the surface will be lofted.

Input slots (optional):

Rail-1 GDL Curve object

Guide rail corresponding to minimum U parameter of resulting surface. Defaults to nil.

Rail-1-is-spine? Boolean

If specified as non-nil, then the rail-1 will be used as a spine curve similar to what isdescribed on page 462 of the NURBS book. Default is nil.

Page 283: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 277

(in-package :surf)

(define-object test-lofted-surface (base-object)

:input-slots

((curves (list (the curve-1) (the curve-2) (the curve-3) (the curve-4) )))

:objects

((lofted-surface :type ’lofted-surface

:curves (the curves))

(curve-1 :type ’b-spline-curve

:display-controls (list :color :red :line-thickness 3)

:control-points (list (make-point 0 0 0)

(make-point 1 1 0)

(make-point 0 1 0)

(make-point 0 0 0) ))

(curve-2 :type ’b-spline-curve

:display-controls (list :color :red :line-thickness 3)

:control-points (list (make-point 0 0 1)

(make-point -1 1 1)

(make-point 0 1 1)

(make-point 0 0 1) ))

(curve-3 :type ’b-spline-curve

:display-controls (list :color :red :line-thickness 3)

:control-points (list (make-point 0 0 2)

(make-point -1 -1 2)

(make-point 0 -1 2)

(make-point 0 0 2) ))

(curve-4 :type ’b-spline-curve

:display-controls (list :color :red :line-thickness 3)

:control-points (list (make-point 0 0 3)

(make-point 1 -1 3)

(make-point 0 -1 3)

(make-point 0 0 3) ))))

(generate-sample-drawing :object-roots (make-object ’test-lofted-surface)

:projection-direction :trimetric)

Figure 11.126: Example Code for lofted-surface

Page 284: Genworks GDL: A User's Manual - Genworks International

278 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.127: lofted-surface example

Rail-1-params List of curve parameters

The parameter value on the rail-1 which should correspond to each respective profilecurve. Defaults to the evenly spaced parameters between the u-min and u-max of therail-1, one for each profile curve.

Rail-2 GDL Curve object

Guide rail corresponding to maximum U parameter of resulting surface. Defaults to nil.If both rail-1 and rail2 are given, then they must be synchronized.

Spine GDL Curve object

Curve to use as spine for calling ascssk.

Synchronized? Boolean

Set this to t if the curves already have synchronized control points. It makes the lofted-surface much lighter-weight in terms of its control mesh. Default is NIL (which meansthe lofted-surface does not assume synchronized control points on the profile curves).

Tolerance Number

The fitting tolerance to fit to the loft curves. 0 means to interpolate exactly. Default is0

Use-ascssk? Boolean

If non-nil, we use the low-level nlib ascssk directly. If nil, we use the SMLib make-skinned-surface routine. Default is nil

V-degree Integer

The degree of the surface in the lofting direction. Defaults to 3.

• manifold-solid

Page 285: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 279

Mixins: brep

Description Attempts to take in a non-manifold brep and yield a manifold version.

Input slots (required):

Brep GDL brep object

The brep to be represented as a manifold brep in this instance.

Input slots (optional):

Keep-internal-faces? Boolean

Indicates whether faces between two non-void regions should be kept. Defaults to nil.

• merged-solid

Mixins: boolean-merge, vanilla-mixin

Description Given two brep solids or a brep solid and an open face represented as a brep,performs a merge operation. Optionally (with make-manifold? t) makes the resultmanifold by trimming and throwing away extra pieces of faces and edges.

Input slots (optional):

Make-manifold? Boolean

Indicates whether the resulting brep should be made into a manifold brep, with one ormore regions.

Sew-and-orient? Boolean

Indicates whether we should try to sew and orient the resulting brep. Usually a goodidea and this is defaulted to t, except for merged-solid where we default this to nil.

• native-reader

Mixins: base-object

Description This object will reflect the contents of an iwp file containing curves, surfaces,breps, and brep trees as sequences of GDL objects.

Input slots (optional):

File-name String or pathname

The location of the IWP file to be read.

Smlib-string String

Contains output from a call to (with-format (native .) (write-the cad-output)) for anSMLib object (e.g. curve, surface, brep). Defaults to nil. If you specify this as well as afile-name, the file-name will take precedence.

Page 286: Genworks GDL: A User's Manual - Genworks International

280 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Objects (sequence):

Breps Sequence of GDL brep objects

The breps found in the IGES file.

Curves Sequence of GDL curve objects

The curves found in the IWP file.

Surfaces Sequence of GDL surface objects

The untrimmed “standalone” surfaces found in the IWP file.

• non-rational-curve

Mixins: curve

Author Dave Cooper, Genworks International

Description This object accepts a rational curve and approximates it with a non-rationalcurve.

Input slots (required):

Curve-in GDL Curve object

Presumably this is a Rational curve (else this object will do nothing).

Input slots (optional):

Maintain-end-tangents? Boolean

Determines whether to try to maintain tangents at the ends. Defaults to t.

Non-rational-degree Integer

Determines the degree of the non-rational curve. Defaults to 3.

Parameterization Keyword symbol, one of :uniform, :chord-length, :centripetal, or :inher-ited

The default is :inherited.

Tolerance Number

The tolerance to use for non-rational approximation of a rational curve-in. Defaults tothe curve-in’s total length divided by the tolerance-divisor.

Tolerance-divisor Number

The amount by which to divide the total-length of the curve-in to compute the defaulttolerance. Default is 1000.

• normalized-curve

Mixins: curve

Description This object creates a new curve from an exiting curve by reasigning the lowestand highest parameter value of the underlying mathematical definition of the curve.This is a precise method, it does not change the curve geometry.

Page 287: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 281

Input slots (optional):

Curve-in GDL NURBS Curve

The curve to be normalized.

Tolerance Number

Approximation tolerance for display purposes. Defaults to the tolerance of the built-fromcurve, if one exists, otherwise defaults to the *display-tolerance*.

U-max The highest parameter value of the underlying mathematical definition for this para-metric curve

U-min The lowest parameter value of the underlying mathematical definition for this para-metric curve

• offset-solid

Mixins: brep

Description Offsets the faces of a brep by a certain distance.

Input slots (required):

Brep GDL Brep object

The brep to be offset.

Distance Number

The distance to offset. Can be negative.

Input slots (optional):

Tolerance Number

The tolerance to use for the shelling operation. Defaults to (the adaptive-tolerance) ofthe input brep.

• offset-surface

Mixins: surface

Description This primitive generates a new surface which is offset from input surface inall normal directions from input surface.

Input slots (required):

Distance Number

The distance to offset. Positive or negative, depending on which direction you want.

Surface-in GDL Surface object

The original surface from which to make the offset.

Input slots (optional):

Page 288: Genworks GDL: A User's Manual - Genworks International

282 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Approximation-tolerance Number

The tolerance of approximation for the re-fitting of points after the offsetting. Defaultsto *3d-approximation-tolerance-default*.

Parameterization Keyword symbol, one of :uniform, :chord-length, :centripetal, or :inher-ited

The parameterization method used to re-fit the points after offsetting. Defaults to:uniform.

U-degree Integer

The desired u-degree of the resulting surface. Defaults to the u-degree of the inputsurface-in.

V-degree Integer

The desired v-degree of the resulting surface. Defaults to the v-degree of the inputsurface-in.

• planar-offset-curve

Mixins: curve

Description Creates a curve which is the result of offsetting a curve by its normals alonga plane.

Input slots (required):

Curve-in GDL Curve

The curve to be offset

Distance Number

The left-hand distance to offset with respect to curve direction. To get the oppositedirection, you can either negate this number or reverse the plane-normal.

Plane-normal 3D Vector

The normal for the plane

Input slots (optional):

Tolerance Number

The tolerance for approximating the resulting offset curve. Defaults to *3d-approximation-tolerance-default*.

• planar-section-curve

Mixins: curve

Description Produces a single curve by sectioning a surface with a plane. If multiple resultsare expected, use planar-section-curves instead.

Input slots (required):

Page 289: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 283

(in-package :surf)

(define-object test-planar-offset-curve ()

:computed-slots

((curve-in (the b-spline-curves (curves 3)))

(plane-normal (make-vector 0 0 -1))

(distance 1) )

:objects

((b-spline-curves :type ’test-b-spline-curves

:hidden? t)

(curve-to-be-offset :type ’curve

:built-from (the b-spline-curves (curves 3)))

(planar-offset-curve :type ’surf:planar-offset-curve

:curve-in (the curve-to-be-offset)

:plane-normal (make-vector 0 0 -1)

:distance 1)))

(generate-sample-drawing :object-roots (list (make-object ’test-planar-offset-curve))

:projection-direction (getf *standard-views* :top))

Figure 11.128: Example Code for planar-offset-curve

Figure 11.129: planar-offset-curve example

Page 290: Genworks GDL: A User's Manual - Genworks International

284 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-planar-section-curve (base-object)

:objects

((planar-section-curve :type ’planar-section-curve

:surface (the test-surf)

:plane-normal (the (face-normal-vector :top))

:plane-point (make-point 0 0 2)

:display-controls (list :color :red :line-thickness 4))

(test-surf :type ’test-fitted-surface )))

(generate-sample-drawing :object-roots (list (make-object ’test-planar-section-curve))

:projection-direction (getf *standard-views* :trimetric))

Figure 11.130: Example Code for planar-section-curve

Figure 11.131: planar-section-curve example

Page 291: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 285

Surface GDL Surface, face, or trimmed surface

The surface to be sectioned with a plane.

Input slots (optional):

3d-approximation-tolerance Number

Tolerance used when approximating in e.g. Newton-Raphson iterations. Default is *3d-approximation-tolerance-default*.

Angle-tolerance-radians Number

Angular tolerance (in radians) used when approximating in e.g. Newton-Raphson iter-ations. Default is *angle-tolerance-radians-default*.

Plane-normal Vector

The normal of the sectioning plane. Defaults to the top vector of the local reference box.

Plane-point 3D Point

A point on the sectioning plane. Defaults to the center.

Computed slots:

On-surfaces List of GDL surfaces

The surfaces on which this curve lies.

Success? Boolean

This will be non-nil if the curve was generated successfully.

Gdl functions:

Uv-curve GDL Curve object

The UV curve for this curve in the context of the surface.

• planar-section-curves

Mixins: base-object

Description Produces multiple curves by sectioning a surface or a brep with a plane. If asingle result is expected, use planar-section-curve instead.

Input slots (optional):

3d-approximation-tolerance Number

Tolerance used when approximating in e.g. Newton-Raphson iterations. Default is *3d-approximation-tolerance-default*.

Angle-tolerance-radians Number

Angular tolerance (in radians) used when approximating in e.g. Newton-Raphson iter-ations. Default is *angle-tolerance-radians-default*.

Page 292: Genworks GDL: A User's Manual - Genworks International

286 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-planar-section-curves (base-object)

:computed-slots

((points-data ’(((0 0 0)(0 1 0)(1 1 0)(1 0 0))

((0 0 1) (0 1 1) (1 1 1) (1 0 1) )

((0 0 2) (0 1 2) (1 1 2) (1 0 2) )

((0 0 3) (0 1 3) (1 1 3) (1 0 3) )))

(control-points (mapcar #’(lambda(list) (mapcar #’apply-make-point list))

(the points-data))))

:objects

((planar-section-curve :type ’planar-section-curves

:surface (the test-surf)

:plane-normal (the (face-normal-vector :front))

:plane-point (make-point 0 0.5 0)

:display-controls (list :color :red :line-thickness 4))

(test-surf :type ’b-spline-surface

:control-points (the control-points)) ))

(generate-sample-drawing :object-roots

(list (make-object ’test-planar-section-curves))

:projection-direction

(getf *standard-views* :trimetric))

Figure 11.132: Example Code for planar-section-curves

Page 293: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 287

Figure 11.133: planar-section-curves example

Brep GDL Brep object

The brep to be sectioned with a plane. Specify this or surface, not both.

Plane-normal Vector

The normal of the sectioning plane. Defaults to the top vector of the local reference box.

Plane-point 3D Point

A point on the sectioning plane. Defaults to the center.

Surface GDL Surface object

The surface to be sectioned with a plane. Specify this or brep, not both.

Computed slots:

3d-approximation-tolerance-achieved Number

The actual tolerance achieved by the operation.

Angle-tolerance-radians-achieved Number

The actual angle tolerance achieved by the operation.

Objects (sequence):

Curves Sequence of GDL Curve Objects

The curves resulting from sectioning.

Uv-curves Sequence of GDL uv curve objects

The UV curves for each returned curve. This is also passed into each curve object andavailable from there.

Page 294: Genworks GDL: A User's Manual - Genworks International

288 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-planar-surface (planar-surface)

:computed-slots

((display-controls (list :color :fuchsia :transparency 0.5))

(p00 (make-point 0 0 0))

(p01 (make-point 0 1 0))

(p10 (make-point 1 0 0))

(p11 (make-point 1.5 1.5 0))))

(generate-sample-drawing :objects (make-object ’test-planar-surface)

:projection-direction :trimetric)

Figure 11.134: Example Code for planar-surface

• planar-surface

Mixins: surface

Description Creates a flat quadrilateral surface specified by its four corner points.

Input slots (required):

P00 3D point

Front-left corner of the planar surface.

P01 3D point

Front-right corner of the planar surface.

P10 3D point

Rear-left corner of the planar surface.

P11 3D point

Rear-right corner of the planar surface.

• poly-brep

Mixins: geometry-kernel-object-mixin, base-object

Description A polygonal representation for a boundary representation geometric entity.

Computed slots:

Mesh-data Plist

Contains mesh data from the poly brep.

• projected-curve

Mixins: curve

Page 295: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 289

Figure 11.135: planar-surface example

Description Creates a 3D curve which is the curve-in projected onto the surface. ac-cording to the projection-vector. The resulting curve contains a uv-curve which istypically useful for trimming.

NOTE: Change from 1577p027 and forward – the projected curve now is a 3D curvewhich can be drawn. It contains its uv representation on the surface. Previously, theuv-curve was the actual projected-curve.

Input slots (required):

Curve-in GDL NURBS Curve

The curve to be projected to the surface.

Projection-vector 3D Vector

The direction of projection.

Surface GDL NURBS Surface

The surface on which the curve-in is to be projected.

Input slots (optional):

Angle-tolerance-radians Number or nil

The angle tolerance used when projecting and creating new curves. Defaults to nil,which uses the default of the geometry kernel.

Approximation-tolerance Number or nil

The tolerance used when projecting and creating new curves. Defaults to nil, which usesthe default of the geometry kernel.

Page 296: Genworks GDL: A User's Manual - Genworks International

290 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-trimmed-from-projected-2 (trimmed-surface)

:computed-slots

((uv-inputs t)

(island (the island-3d uv-curve))

(holes (list (the hole uv-curve)))

(display-controls (list :color :blue :line-thickness 2)))

:objects

((basis-surface :type ’test-fitted-surface

:display-controls (list :color :pink)

:grid-length 10 :grid-width 10 :grid-height 5

)

(raised-hole :type ’b-spline-curve

:display-controls (list :color :grey-light-very)

:control-points (list (make-point 3.5 4.5 7)

(make-point 4.5 6 7)

(make-point 5.5 7 7)

(make-point 6 4.5 7)

(make-point 5.5 2 7)

(make-point 4.5 2 7)

(make-point 3.5 4.5 7)))

(raised-island :type ’b-spline-curve

:display-controls (list :color :grey-light-very)

:control-points (list (make-point 3 5 7)

(make-point 5 8 7)

(make-point 7 10 7)

(make-point 8 5 7)

(make-point 7 0 7)

(make-point 5 0 7)

(make-point 3 5 7))))

:hidden-objects

((island-3d :type ’projected-curve

:curve-in (the raised-island)

:surface (the basis-surface)

:projection-vector (make-vector 0 0 -1))

(hole :type ’projected-curve

:curve-in (the raised-hole)

:surface (the basis-surface)

:projection-vector (make-vector 0 0 -1))))

(generate-sample-drawing

:objects (let ((self (make-object ’test-trimmed-from-projected-2)))

(list (the basis-surface) self (the raised-island)

(the raised-hole)))

:projection-direction :trimetric)

Figure 11.136: Example Code for projected-curve

Page 297: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 291

Figure 11.137: projected-curve example

Computed slots:

Built-from GDL Curve

Specify this if you want this curve to be a clone of an existing curve. (note - this uses ashared underlying curve object, it does not make a copy)

Hidden objects:

Uv-curve GDL UV curve object

The resultant projected-curve in the UV space of the surface.

• rectangular-surface

Mixins: planar-surface

Description Creates a flat rectangular surface specified by the same inputs as box or base-object.

Input slots (required):

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Page 298: Genworks GDL: A User's Manual - Genworks International

292 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-rectangular-surface (rectangular-surface)

:computed-slots ((display-controls (list :color :green-spring-medium))

(length 20) (width 30) (height 0)))

(generate-sample-drawing :objects (make-object ’test-rectangular-surface)

:projection-direction :trimetric)

Figure 11.138: Example Code for rectangular-surface

Figure 11.139: rectangular-surface example

Page 299: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 293

Input slots (optional, defaulting):

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

Computed slots:

P00 3D point

Front-left corner of the planar surface.

P01 3D point

Front-right corner of the planar surface.

P10 3D point

Rear-left corner of the planar surface.

P11 3D point

Rear-right corner of the planar surface.

• redirected-surface

Mixins: b-spline-surface

Description Generates a new surface with U and V parameters swapped and/or reversedin their direction.

Input slots (required):

Surface-in GDL surface object

Input slots (optional):

Reverse-u? Boolean

Specifies whether resulting U parameter space should be reversed. Defaults to nil.

Reverse-v? Boolean

Specifies whether resulting V parameter space should be reversed. Defaults to nil.

Swap-uv? Boolean

Specifies whether existing U and V should be swapped before possibly reversing. Defaultsto nil.

Computed slots:

Control-points List of lists of 3D Points

The control net.

U-degree Integer

Degree of surface in U direction. Defaults to 3.

Page 300: Genworks GDL: A User's Manual - Genworks International

294 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

U-knot-vector List of Numbers

Knots in U direction. Default is NIL, which indicates a uniform knot vector in Udirection.

V-degree Integer

Degree of surface in V direction. Defaults to 3.

V-knot-vector List of Numbers

Knots in V direction. Default is NIL, which indicates a uniform knot vector in Vdirection.

Weights List of lists of numbers

A weight to match each control point. Should be congruent with control-points (i.e.same number of rows and columns). Default is a value of 1.0 for each weight, resultingin a nonrational surface.

• regioned-solid

Mixins: base-object

Description Given a brep solid that contains multiple regions, splits the regions into sep-arate breps

Input slots (required):

Brep GDL Brep object or object containing a brep

The multi-region brep to be split.

Input slots (optional):

Section-colors List of Color Keywords

These indicate the colors for any child breps if the regioning operation results in multiplesolids. Defaults to a repeating (circular) list with keys:

– :green

– :red

– :blue

– :purple-dark

– :violet

– :cyan.

• revolved-surface

Mixins: brep, surface

Description Creates a surface of revolution based on an arbitrary NURBS curve revolvedby some angle about a central axis and axis point.

Input slots (required):

Page 301: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 295

(in-package :surf)

(define-object test-revolved-surface (revolved-surface)

:computed-slots ((display-controls (list :color :green-yellow2)))

:hidden-objects

((curve :type ’arc-curve

:center (translate (the center) :right 50)

:orientation (alignment :top (the (face-normal-vector :rear)))

:start-angle (half pi)

:end-angle (* 3/2 pi)

:radius 10)))

(generate-sample-drawing :objects (make-object ’test-revolved-surface)

:projection-direction :trimetric)

Figure 11.140: Example Code for revolved-surface

Figure 11.141: revolved-surface example

Page 302: Genworks GDL: A User's Manual - Genworks International

296 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Curve GDL Curve object

The profile to be revolved.

Input slots (optional):

Arc Angle in radians

The amount to revolve. Default is twice pi (a full circle of revolution).

Axis-point 3D Point

The center of revolution. Default value is the center.

Axis-vector 3D Vector

The direction of axis of revolution. Default is the top of the reference box.

Input slots (optional, defaulting):

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

• revolved-surfaces

Mixins: base-object

Description Creates a set of surfaces of revolution based on a list of arbitrary NURBScurves revolved by some angle about a central axis and axis point.

Input slots (required):

Curves List of GDL Curve objects

The profiles to be revolved.

Input slots (optional):

Arc Angle in radians

The amount to revolve. Default is twice pi (a full circle of revolution).

Axis-point 3D Point

The center of revolution. Default value is the center.

Axis-vector 3D Vector

The direction of axis of revolution. Default is the top of the reference box.

Objects (sequence):

Surfaces Sequence of GDL Surfaces

The resultant revolved surfaces.

• ruled-surface

Mixins: surface

Page 303: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 297

(in-package :gdl-user)

(define-object test-revolved-surfaces (revolved-surfaces)

:computed-slots ((curves (list (the curve-1) (the curve-2))))

:hidden-objects

((curve-1 :type ’arc-curve

:center (translate (the center) :right 50)

:orientation (alignment :top (the (face-normal-vector :rear)))

:start-angle 0

:end-angle (/ pi 4)

:radius 10)

(curve-2 :type ’arc-curve

:center (translate (the center) :right 50)

:orientation (alignment :top (the (face-normal-vector :rear)))

:start-angle pi

:end-angle (* 5/4 pi)

:radius 10)

(view :type ’base-view

:projection-vector (getf *standard-views* :trimetric)

:page-width (* 5 72) :page-length (* 5 72)

:object-roots (list self))))

(generate-sample-drawing

:objects (list-elements (the-object (make-object ’test-revolved-surfaces)

surfaces))

:projection-direction :trimetric)

Figure 11.142: Example Code for revolved-surfaces

Page 304: Genworks GDL: A User's Manual - Genworks International

298 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Figure 11.143: revolved-surfaces example

(in-package :surf)

(define-object test-ruled-surface (ruled-surface)

:computed-slots ((display-controls (list :color :orchid-dark)))

:hidden-objects

((curve-1 :type ’linear-curve

:start (make-point -1 -1 0)

:end (make-point -1 1 0))

(curve-2 :type ’fitted-curve

:points (list (make-point 1 -1 0) (make-point 0 0 0)

(make-point .5 .5 0) (make-point 1 2 0)))))

(generate-sample-drawing :objects (make-object ’test-ruled-surface)

:projection-direction :trimetric)

Figure 11.144: Example Code for ruled-surface

Page 305: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 299

Figure 11.145: ruled-surface example

Description Creates a surface between two NURBS curves.:

Input slots (required):

Curve-1 GDL Curve object

First boundary of the ruled surface.

Curve-2 GDL Curve object

Second boundary of the ruled surface.

Input slots (optional):

Direction Keyword symbol, either :u or :v

The direction of parameterization of the surface between the two curves.

• separated-solid

Mixins: boolean-merge, vanilla-mixin

Description Given two brep solids or a brep solid and an open face represented as a brep,performs a split operation

Input slots (optional):

Cap-results? Boolean

Indicates whether the resulting split pieces should be made into watertight solids (endscapped, etc).

Page 306: Genworks GDL: A User's Manual - Genworks International

300 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Section-colors List of Color Keywords

These indicate the colors for any child breps if the boolean operation results in a sep-arated solid. If the number of breps exceeds the length of this list, the colors will berepeated in order. Defaults to a list with keys:

– :green

– :red

– :blue

– :purple-dark

– :violet

– :cyan.

Objects (sequence):

Breps Sequence of GDL brep objects

The resulting breps yielded from the separate operation. These are colored using section-colors.

• shelled-solid

Mixins: brep

Description Offsets the faces of a brep by a certain thickness.

Input slots (required):

Brep GDL Brep object

Should be an open shell. The brep to be shelled into a solid.

Distance Number

The distance to offset. Can be negative.

Input slots (optional):

Tolerance Number

The tolerance to use for the shelling operation. Defaults to (the adaptive-tolerance) ofthe input brep.

• spherical-surface

Mixins: surface, sphere

Description A surface representation of the sphere. Takes the same inputs as native GDLsphere. Partial spheres are not yet implmented. Note that some VRML browsers, e.g.Cortona v. 4.2, show some spurious artifacts with NURBS created as spherical surfaces.BS Contact does not appear to have this problem.

Input slots (optional, defaulting):

Page 307: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 301

(in-package :surf)

(define-object test-spherical-surface (spherical-surface)

:computed-slots ((display-controls (list :color :sky-summer))

(radius 10)))

(generate-sample-drawing :objects (make-object ’test-spherical-surface)

:projection-direction :trimetric)

Figure 11.146: Example Code for spherical-surface

Figure 11.147: spherical-surface example

Page 308: Genworks GDL: A User's Manual - Genworks International

302 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Center 3D Point

Indicates in global coordinates where the center of the reference box of this object shouldbe located.

• spiral-curve

Mixins: curve

Author Dave Cooper, Genworks International

Description This object approximates a spiral around the Z axis using a cubic NURBS(b-spline-curve).

Input slots (required):

Height Number

The height of the spiral.

Number-of-turns Number

The number of turns (1 = 360 degrees) in the spiral.

Radius-1 Number

Initial radius at Z=0.

Radius-2 Number

Final radius at z=height.

Input slots (optional):

Right-or-left Keyword Symbol, :right or :left

Defaults to :right.

Tolerance Number

The tolerance to use for non-rational approximation of a rational curve-in. Defaults tothe height divided by the tolerance-divisor.

Tolerance-divisor Number

The amount by which to divide the height of the curve-in to compute the default toler-ance. Default is 1000.

• split-surface

Mixins: surface

Description Given a NURBS and a parameter in U or V direction, split the surface atthe parameter and return one section or the other as the toplevel self of this instance.Note that both resulting sections are also reflected in (the surfaces) sequence which is ahidden child in this object.

As an alternative to a parameter, a projection-point and projection-vector can also begiven, and the U or V parameter at the resulting surface point will be used as theparameter.

Page 309: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 303

(in-package :gdl-user)

(define-object test-split-surface (base-object)

:computed-slots ((projection-point (make-point 10 0 3))

(projection-vector (make-vector 1 0 0))

(u-or-v :u :settable)

(keep-side :left :settable))

:objects

((test-surface :type ’test-b-spline-surface

:display-controls nil)

(split :type ’split-surface

:display-controls (list :color :red :line-thickness 3)

:surface-in (the test-surface)

:pass-down (keep-side u-or-v projection-point projection-vector))))

(generate-sample-drawing :object-roots (make-object ’test-split-surface)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.148: Example Code for split-surface

Figure 11.149: split-surface example

Page 310: Genworks GDL: A User's Manual - Genworks International

304 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Input slots (optional):

Keep-side Keyword symbol, one of :left or :right

Determines which half of the split surface to reflect in this instance. Both halves will bereflected in (the surfaces) hidden-object sequence which is a child of this instance.

Parameter Number

The parameter in U or V direction at which to do the split. This must lie in the domainbetween (the u-min) [or (the v-min)] and (the u-max) [or (the v-max)] of the surface-in. If it is outside this domain, a warning will be thrown and the value will be pinnedto the nearest value within the domain. If this input is not specified and you specify aprojection-point and projection-vector, then this projected point will be used to establishthe parameter for splitting.

Projection-point 3D Point or nil

If given and parameter is not given, this point will be projected onto the surface using(the projection-vector) to establish the split parameter. Defaults to nil.

Projection-vector 3D Vector or nil

If given and parameter is not given, this will be used to project (the projection-point)onto the surface to establish the split parameter. Defaults to nil.

Surface-in GDL Surface object

The surface to be split.

U-or-v Keyword symbol, one of :u or :v

Determines the direction of the split.

Computed slots:

Projected-point Surface point

Returns the first result of the given point projected along the given vector intersectedwith the surface.

Projected-points List of Surface points

Returns the given point projected along the given vector intersected with the surface.

• step-reader

Mixins: base-object

Description This object will reflect the contents of a STEP file containing points, curves,surfaces, and/or trimmed surfaces as sequences of GDL objects. Currently all sur-faces are treated as trimmed, where actual untrimmed surfaces have their natural outerboundaries as the result-island, i.e. no standalone surfaces will be produced by this part.

This is a default option in the HarmonyWare STEP Translator which will be exposed inGDL in a future release.

The HarmonyWare reader creates a log file in a temporary directory. The location ofthis log file is printed on the console during the reading operation. Currently this logfile is not automatically deleted, and its name is determined by the system.

Page 311: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 305

Input slots (required):

File-name String or pathname

The location of the STEP file to be read.

Input slots (optional):

Group-trimmed-surfaces-into-brep? Boolean

If true, group all trimmed surfaces in the file into one B-rep. If some trimmed surfacesare blanked, they are grouped into a second, blanked B-rep. Default is nil.

Make-all-surfaces-trimmed? Boolean

If true, treat all untrimmed surfaces in the file as if they are trimmed surfaces withthe natural outer boundary of the surface as the trimming loop. If used, no standaloneIwSurface surface objects will ever be returned by the reader. Default is nil.

Make-single-brep? Boolean

If true, group all trimmed surfaces and B-reps in the file into one B-rep. If some trimmedsurfaces or B-reps are blanked, they are grouped into a second, blanked B-rep. Defaultis nil.

Sew-brep-faces? Boolean

Indicates whether each resulting brep should have its faces sewn together. Default is(the make-single-brep?).

Objects (sequence):

Breps Sequence of GDL brep objects

The breps and trimmed surfaces (represented as breps) found in the STEP file.

Curves Sequence of GDL curve objects

The curves found in the STEP file.

Points Sequence of GDL point objects

The points found in the STEP file.

Surfaces Sequence of GDL surface objects

The untrimmed “standalone” surfaces found in the STEP file.

• stitched-solid

Mixins: brep

Description Attempts to stitch together a list of surfaces into an open shell or possibly amanifold solid. This primitive is not widely tested and may be deprecated. Consideruse of merged-solid instead. Please let Genworks know if you are using this so we canconsider documenting/testing it better.

Input slots (required):

Page 312: Genworks GDL: A User's Manual - Genworks International

306 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Faces-in List of GDL Surface or Face objects

These will be stitched together into an open shell or possibly a Solid

Input slots (optional):

Tolerance Number

The tolerance to use for creating the brep and for sewing. Larger number is loosertolerance and more likely to lead to success. Default is 0.0 which uses the SMLibdefaults.

• subtracted-solid

Mixins: boolean-merge, vanilla-mixin

Description Given two brep solids, performs the subtract Boolean of the other-brep fromthe brep

• surface

Mixins: geometry-kernel-object-mixin, outline-specialization-mixin, base-object

Description A generalized NURBS surface. Usually used as a mixin in more specific sur-faces.

Input slots (optional):

Brep-tolerance Number

Overall tolerance for the internal brep representation of this surface. Defaults to nil.Note that a value of nil indicates for SMLib a value of 1.0e-05 of the longest diagonallength of the brep.

Built-from GDL Surface

Specify this if you want this surface to be a clone of an existing surface (note - this usesa shared underlying surface object, it does not make a copy)

End-caps-on-brep? Boolean

Indicates whether to attempt automatic endcaps on conversion of this surface to a brep.Note that this might change in future to a keyword value for :min, :max, or :both toprovide more control.

Rational? Boolean

Returns non-nil iff this surface is rational, i.e. all weights are not 1.

Sew-and-orient-brep? Boolean

Indicates whether brep representation should undergo a sew-and-orient operation. De-faults to nil.

Tessellation-parameters Plist of keyword symbols and numbers

This controls tessellation for the brep of this surface. The keys are as follows:

– :min-number-of-segments

Page 313: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 307

– :max-3d-edge-factor

– :min-parametric-ratio

– :max-chord-height

– :max-angle-degrees

– :min-3d-edge

– :min-edge-ratio-uv

– :max-aspect-ratio

and the defaults come from the following parameters:

(list

:min-number-of-segments *tess-min-number-of-segments*

:max-3d-edge-factor *tess-max-3d-edge-factor*

:min-parametric-ratio *tess-min-parametric-ratio*

:max-chord-height *tess-max-chord-height*

:max-angle-degrees *tess-max-angle-degrees*

:min-3d-edge *tess-min-3d-edge*

:min-edge-ratio-uv *tess-min-edge-ratio-uv*

:max-aspect-ratio *tess-max-aspect-ratio*)

Tolerance Number

Approximation tolerance for display purposes.

Input slots (optional, defaulting):

Isos Plist with keys :n-u and :n-v

The number of isoparametric curves to be displayed in each direction. This value comesfrom the value of :isos on the display-controls if that exists, and defaults to *isos-default*otherwise.

Computed slots:

Bounding-box List of two 3D points

The left front bottom and right rear top corners, in global coordinates, of the rectangularvolume bounding the tree of geometric objects rooted at this object.

Height Number

Z-axis dimension of the reference box. Defaults to zero.

Length Number

Y-axis dimension of the reference box. Defaults to zero.

Width Number

X-axis dimension of the reference box. Defaults to zero.

Hidden objects:

Page 314: Genworks GDL: A User's Manual - Genworks International

308 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Brep GDL Brep object

This is the brep representation of this surface.

Swapped-uv-surface GDL surface object

This surface object swaps the role of u and v- directional parameters, i.e. old-surface(u,v)= new-surface(v,u).

Hidden objects (sequence):

U-iso-curves Sequence of curve objects

The isoparametric curves in the U direction.

V-iso-curves Sequence of curve objects

The isoparametric curves in the V direction.

Gdl functions:

Area Number

Returns the area of the surface.

B-spline-data List of lists 3D points, List of lists numbers, List of numbers, List of numbers,Integer, and Integer. Returns six values which are the control points, the weights, theu-knots, the v-knots, the u-degree, and the v-degree of the surface.

Curve-intersection-point Surface point

Returns the first point of intersection between this surface and the curve given as anargument.

Curve-intersection-points List of Surface points

Returns the point(s) of intersection between this surface and the curve given as anargument.

Domain Plist

Returns plist containing :min and :max indicating min and max UV points for parameterspace for this surface.

Dropped-point Surface point

Returns the given 3D point dropped normally to this surface, as close as possible to thegiven 3D point.

Dropped-points List of Surface points

Returns the given 3D point dropped normally to this surface.

Local-bounding-box Returns a bbox object, answering xmin, ymin, zmin, xmax, ymax,and zmax, for a box containing the convex hull (i.e. the control points) of this surfaceand oriented according to the given center and orientation.

Maximum-distance-to-curve Plist

The returned plist contains information about the maximum distance from this surfaceto the curve given as the argument.

Page 315: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 309

Maximum-distance-to-surface Plist

The returned plist contains information about the maximum distance from this surfaceto the surface given as the argument.

Minimum-distance-to-curve Plist

The returned plist contains information about the minimum distance from this surfaceto the curve given as the argument.

Minimum-distance-to-surface Plist

The returned plist contains information about the minimum distance from this surfaceto the surface given as the argument.

Normal 3D Vector

The surface normal vector at the given u and v values. Three other values are alsoreturned: The 3D point, the U tangent, and the V tangent at the given parameter value.

Offset-point 3D Point

Returns the surface point at the given parameters offset along the surface normal at thatpoint by the given distance.

On? Boolean

Returns non-nil if the given UV (2D) point lies within the parameter space of this surface.Currently this function works only on the basis surface ; it does not observe trimmingisland or holes.

Point 3D Point

The point on the surface corresponding to the given u and v parameter values.

Projected-point Surface point

Returns the first result of the given point projected along the given vector intersectedwith the surface.

Projected-points List of Surface points

Returns the given point projected along the given vector intersected with the surface.

Radius-of-curvature Number

Returns the Gaussian curvature on the surface at the given parameter values. Threeadditional values are returned, which are the Normal Curvature at the point, the firstFundamental Principle Curvature, and the second Fundamental Principle Curvature.

U-max Number

Returns maximum U component of the surface parameter space.

U-min Number

Returns minimum U component of the surface parameter space.

V-max Number

Returns maximum V component of the surface parameter space.

V-min Number

Returns minimum V component of the surface parameter space.

Page 316: Genworks GDL: A User's Manual - Genworks International

310 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

• surface-knot-reduction

Mixins: surface

Description This routine removes all removable knots from a GDL surface.

Input slots (optional):

Direction Keyword symbol, one of :u, :v or :uv

Default is :uv.

Surface Gdl surface object

.

Tolerance Number

.

• swept-solid

Mixins: brep

Description This primitive will take a brep as input, and sweep all its faces in the givendirection by the given distance, to produce another brep.

Input slots (required):

Distance Number

The distance over which the sweep is desired.

Facial-brep GDL Brep object

The original brep, which can contain one or more faces, planar and/or non-planar.

Vector GDL Vector

The direction in which the sweep is desired.

• transformed-solid

Mixins: brep

Description This primitive Translates, Orients, and optionally Scales a brep solid intoanother brep solid.

Input slots (required):

Brep GDL Brep Object

Source Brep to be copied and transformed.

Input slots (optional):

From-location 3D Point

Reference location from which to translate. Defaults to the from-object center.

Page 317: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 311

(in-package :gdl-user)

(define-object surface-knot-reduction-test (base-object)

:input-slots

((control-points (list (make-point 0 0 0)

(make-point 2 3.0 0.0)

(make-point 4 2.0 0.0)

(make-point 5 0.0 0.0)

(make-point 4 -2.0 0.0)

(make-point 2 -3.0 0.0)

(make-point 0 0 0))))

:objects

((curve-1 :type ’b-spline-curve

:display-controls (list :line-thickness 2

:color :green-spring-medium)

:control-points (the control-points))

(curve-2 :type ’boxed-curve

:display-controls (list :line-thickness 2 :color :blue)

:curve-in (the curve-1)

:center (make-point 0 0 8))

(curve-3 :type ’transformed-curve

:display-controls (list :line-thickness 2 :color :green)

:curve-in (the curve-1)

:to-location (translate

(the center)

:up 3)

:center (the center)

:scale-x 1.3

:scale-y 1.3)

(curve-4 :type ’transformed-curve

:display-controls (list :line-thickness 2 :color :red)

:curve-in (the curve-1)

:to-location (translate

(the center)

:up 7)

:center (the center)

:scale-x 2.2

:scale-y 2.2)

(lofted-surface-test-simple :type ’lofted-surface

:display-controls (list :color :red-violet

:isos (list :n-v 19

:n-u 19))

:tolerance 0.01

:curves (list (the curve-1) (the curve-3)

(the curve-4) (the curve-2)))

(S-knot-reduction :type ’surface-knot-reduction

:surface (the lofted-surface-test-simple))))

Figure 11.150: Example Code for surface-knot-reduction

Page 318: Genworks GDL: A User's Manual - Genworks International

312 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :gdl-user)

(define-object swept-solid-example (swept-solid)

:computed-slots

((facial-brep (the trimmed brep))

(vector (make-vector 0 0 1))

(distance 10)

(display-controls (list :isos (list :n-u 8 :n-v 8) :color :blue :transparency 0.3)))

:hidden-objects

((rectangle :type ’rectangular-surface

:width 20 :length 20)

(trim-curve :type ’global-filleted-polyline-curve

:vertex-list (list (translate (the center) :right 8 :rear 8)

(translate (the center) :left 8 :rear 8)

(translate (the center) :left 8 :front 8)

(translate (the center) :right 8 :front 8)

(translate (the center) :right 8 :rear 8))

:default-radius 3)

(trimmed :type ’trimmed-surface

:basis-surface (the rectangle)

:reverse-island? t

:island (the trim-curve))))

(generate-sample-drawing :objects (make-object ’swept-solid-example)

:projection-direction (getf *standard-views* :trimetric))

Figure 11.151: Example Code for swept-solid

Page 319: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 313

Figure 11.152: swept-solid example

From-object GDL Object

Reference Object for from-location and from-orientation. Defaults to the given brep.

From-orientation 3x3 Orientation Matrix or nil

Defaults to the from-object’s orientation.

Scale 3D Vector or nil

Scale to be applied before transform in each axis, or nil if no scale to be applied.

Sew-and-orient? Boolean

Controls whether to do the shrink cleanup step after the tranform. Defaults to nil.

Shrink? Boolean

Controls whether to do the shrink cleanup step after the tranform. Defaults to nil.

To-location 3D Point

Reference location to which to translate. Defaults to the from-object center.

To-orientation 3x3 Orientation Matrix or nil

Target orientation relative to the from-orientation. Defaults to nil.

• trimmed-curve

Mixins: curve

Description Creates a curve based on an existing curve but possibly with new start andend parameters (u1 and u2).

Input slots (required):

Page 320: Genworks GDL: A User's Manual - Genworks International

314 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-trimmed-curve ()

:objects

((b-spline-curve :type ’b-spline-curve

:control-points (list (make-point 0 0 0)

(make-point 2 3.0 0.0)

(make-point 4 2.0 0.0)

(make-point 5 0.0 0.0)

(make-point 4 -2.0 0.0)

(make-point 2 -3.0 0.0)

(make-point 0 0 0)))

(trimmed-curve :type ’trimmed-curve

:built-from (the b-spline-curve)

:u1 0.2

:u2 0.8

:display-controls (list :color :red :line-thickness 1.5))))

(generate-sample-drawing :object-roots (make-object ’test-trimmed-curve))

Figure 11.153: Example Code for trimmed-curve

Figure 11.154: trimmed-curve example

Page 321: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 315

Built-from GDL Curve Object

The underlying curve from which to build this curve.

Input slots (optional):

U1 Number

Specified start parameter. Defaults to the u1 of the built-from.

U2 Number

Specified end parameter. Defaults to the u2 of the built-from.

Computed slots:

Basis GDL Curve

The original untrimmed curve, same as the built-from.

• trimmed-surface

Mixins: face

Description Creates a surface which is trimmed by outer trimming loop curves (the “is-land”), and one or more hole curves within the outer trimming loop. The curves canbe input either as u-v curves or 3D curves. If 3D curves are given, they must lie on thesurface. If not, please use dropped-curve or projected-curve to ensure that the curveslie on the surface.

Note that this object mixes in face, which mixes in surface. So this object should answerall the messages of both face and surface. However, the local surface messages willoperate on the basis, not on the trimmed representation. The messages for face willoperate on the trimmed representation.

NOTE: the interface for this object is still under development so please stay apprised ofany changes.

Input slots (optional):

Basis-surface GDL NURBS Surface

The underlying surface to be trimmed.

Holes List of GDL NURBS Curves or list of lists of GDL NURBS Curves

These curves make up zero or more holes within the outer trimming loop. Normallyshould be in clockwise orientation; if not, please specify reverse-holes? as non-NIL.

Island Single GDL NURBS Curve or list of same

These curves make up the outer trimming loop. Normally should be in counter-clockwiseorientation; if not, please specify reverse-island? as non-NIL.

Reverse-holes? Boolean

Specify this as non-NIL if the holes are given in counter-clockwise orientation. Defaultis NIL.

Page 322: Genworks GDL: A User's Manual - Genworks International

316 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

(in-package :surf)

(define-object test-trimmed-surface-3 (trimmed-surface)

:computed-slots

((reverse-holes? t)

(island (the island-container ordered-curves))

(holes (list (the hole ordered-curves)))

(display-controls (list :color :periwinkle :line-thickness 2)))

:hidden-objects

((basis-surface :type ’test-planar-surface

:display-controls (list :color :grey-light-very))

(island-container :type ’global-filleted-polyline-curves

:default-radius .05

:vertex-list (list (make-point 0 0 0)

(make-point 0.3 0.6 0)

(make-point 0 1 0)

(make-point 1 1 0)

(make-point 1 0 0)

(make-point 0 0 0)))

(island-2 :type ’b-spline-curve

:control-points (list (make-point 0 0 0)

(make-point 0 1 0)

(make-point 1 1 0)

(make-point 1 0 0)

(make-point 0 0 0)))

(hole :type ’global-filleted-polyline-curves

:default-radius .05

:vertex-list (list (make-point 0.5 0.5 0)

(make-point 0.75 0.5 0)

(make-point 0.75 0.75 0)

(make-point 0.5 0.75 0)

(make-point 0.5 0.5 0)))))

(generate-sample-drawing :objects (make-object ’test-trimmed-surface-3)

:projection-direction :trimetric)

Figure 11.155: Example Code for trimmed-surface

Page 323: Genworks GDL: A User's Manual - Genworks International

11.20. SURF (NURBS SURFACE AND SOLIDS GEOMETRY PRIMITIVES) 317

Figure 11.156: trimmed-surface example

Reverse-island? Boolean

Specify this as non-NIL if the island is given in clockwise orientation. Default is NIL.

Uv-inputs Boolean

NIL if feeding in 3D curves, non-NIL if feeding in UV curves.

Computed slots:

Result-holes List of GDL 3D NURBS Curves or list of lists of GDL 3D NURBS Curves

These make up the inner holes of the resultant trimmed surface. If you specified holes

as an input-slot, normally these should be the same or very similar. If the trimmedsurface was read in from an outside system through a translator such as IGES, theresult-holes might return a non-NIL value while the island will always return NIL.

Result-island Single GDL 3D NURBS Curve or list of GDL 3D NURBS Curves

These make up the outer trimming loop of the resultant trimmed surface. If you specifiedisland as an input-slot, normally these should be the same or very similar. If thetrimmed surface was read in from an outside system through a translator such as IGES,the result-island should return a non-NIL value while the island will return NIL.

Hidden objects:

Brep GDL Brep Object

The Brep containing the face corresponding to this trimmed surface.

• united-solid

Mixins: boolean-merge, vanilla-mixin

Page 324: Genworks GDL: A User's Manual - Genworks International

318 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Description Given two brep solids, performs the union Boolean between the brep and theother-brep

• uv-iso-curve

Mixins: vanilla-mixin

Description Convenience object to return UV parameter values on surface.

Gdl functions:

Point 2D point

The UV surface representation at the given parameter value.

11.20.2 Function and Macro Definitions

• get-point-on-curve

(type 3D point intro Returns the point found from a minimum or maximum distance com-putation involving a curve. )

• get-point-on-other-curve

(type 3D point intro Returns the other point found from a minimum or maximum distancecomputation involving a curve. )

• get-point-on-surface

(type 3D point intro Returns the point found from a minimum or maximum distance com-putation involving a surface. )

• with-pinned-values [Macro]

(type Macro intro Takes a list of bindings and body similar to let, but each binding containsa variable, which must already exist in this context, followed by a min and a max value towhich its inner binding will be pinned. If the value of the outer binding falls outside therange, a warning will be issued. )

11.20.3 Variables and Constants

• *3d-approximation-tolerance-default*

• *3d-tolerance-default*

• *angle-tolerance-radians-default*

• *approximation-tolerance-factor*

• *boolean-allow-multiple-regions?*

• *boolean-error-on-invalid-brep?*

• *boolean-operation-tolerance-default*

Page 325: Genworks GDL: A User's Manual - Genworks International

11.21. TASTY (WEB-BASED DEVELOPMENT ENVIRONMENT (TASTY)) 319

• *brep-isos-default*

• *brep-tolerance-default*

• *chain-beziers-for-display?*

• *crease-angle-default*

• *display-tolerance*

• *finalize-lofted-surfaces?*

• *include-vrml-normals?*

• *isos-default*

• *output-units-default*

• *separate-brep-faces-for-vrml?*

• *tess-max-3d-edge-factor*

• *tess-max-angle-degrees*

• *tess-max-aspect-ratio*

• *tess-max-chord-height*

• *tess-min-3d-edge*

• *tess-min-edge-ratio-uv*

• *tess-min-number-of-segments*

• *tess-min-parametric-ratio*

11.21 tasty (Web-based Development Environment (tasty))

11.22 tree (Tree component used by Tasty and potentially as aUI component on its own)

11.22.1 Object Definitions

• newertree

Mixins: sheet-section

Description Implements an interactive graphical tree from a nested list using HTML listelement and CSS.

Input slots (optional):

Page 326: Genworks GDL: A User's Manual - Genworks International

320 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Onclick-function Function of one argument

This function takes a node in the tree as an argument, and should return a plist withkeys :function and :arguments, which is a function in the bashee which will be calledwith the given arguments when the given node in the tree is clicked.

Respondent GDL Object

Object to respond to the form submission. Defaults to self.

Computed slots:

Inner-html String

This can be used with (str .) [in cl-who] or (:princ .) [in htmlGen] to output thissection of the page, without the wrapping :div tag [so if you use this, your code wouldbe responsible for wrapping the :div tag with :id (the dom-id).]

Safe-children List of GDL Instances

All objects from the :objects specification, including elements of sequences as flat lists.Any children which throw errors come back as a plist with error information

• tree

Mixins: sheet-section, tree-node-mixin

Description Implements an interactive grapical tree using HTML table elements.

Input slots (optional):

Button-color

Onclick-function Function of one argument

This function takes a node in the tree as an argument, and should return a plist withkeys :function and :arguments, which is a function in the bashee which will be calledwith the given arguments when the given node in the tree is clicked.

Respondent GDL Object

Object to respond to the form submission. Defaults to self.

Tree-color String

11.23 yadd (Yet Another Definition Documenter (yadd))

11.23.1 Object Definitions

• assembly

Mixins: base-yadd-sheet

Author Dave Cooper (Genworks)

Description “Yet Another Definition Documenter.” Generates documentation for all therelevant packages in the current Lisp session. Presents a standard :write-html-sheetmethod which can also be crawled with a call to

Page 327: Genworks GDL: A User's Manual - Genworks International

11.23. YADD (YET ANOTHER DEFINITION DOCUMENTER (YADD)) 321

(gwl:crawl "yadd:assembly")

The packages to be documented, and whether the green/red supported messages flagsshow up, can be controlled with optional-inputs.

Input slots (optional):

External-only? Boolean

This defaults to nil, if it is set to t, only exported symbols will be considered for docu-mentation.

Packages-to-ignore List of keyword symbols

These packages will be ignored. This list defaults to standard internal and test packages

Computed slots:

Title String

The title of the web page. Defaults to ”Genworks GDL -” .followed by the strings-for-display.

Objects:

Master-index index

Master index of all symbols (objects, functions, parameters, variables, constants)

Objects (sequence):

Package-dokumentations package-dokumentation

Quantified, one for each :package-to-document

Gdl functions:

Main-sheet-body String of HTML

The main body of the page. This can be specified as input or overridden in subclass,otherwise it defaults to the content produced by the :output-function of the same namein the applicable lens for html-format.

• base-yadd-sheet

Mixins: base-ajax-sheet

Author Dave Cooper (Genworks)

Description Base mixin for a yadd sheet

Computed slots:

Page 328: Genworks GDL: A User's Manual - Genworks International

322 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Additional-header-js String of valid HTML

Contains standard jQuery files to include in the header for additional search funcional-ity. This computed-slot contains javascript files, found in the *gdl-install-dir* and usedthroughout the yadd pages for the generation of automatic search forms (like the master-index). The javascript loaded is jquery.

Default-header-content String of valid HTML

Contains default header contents for yadd html files. This computed-slot is availablein all children of this object. It contains links to default header content of a HTMLgenerated yadd page. This contains a link to the favicon.ico and a link to a default CSSsheet. All these elements can be found in the *gdl-install-dir*/static/gwl/ directories.

• master-index

Mixins: base-yadd-sheet

Author Dave Cooper (Genworks)

Description Prints bullet list of symbols as links to their documentation pages.

Input slots (required):

Symbols-for-index List of lists

Each list contains the page object for the symbol’s documentation and the symbol’sprint-name. The list should be sorted based on the symbols’ print-names.

Computed slots:

Additional-header-js-content valid javascript

This javascript is added to the head of the page, just before the body.

Main-sheet-body String of HTML

The main body of the page. This can be specified as input or overridden in subclass,otherwise it defaults to the content produced by the :output-function of the same namein the applicable lens for html-format.

Use-jquery? Boolean

Include jquery javascript libraries in the page header? Default nil.

• package-dokumentation

Mixins: base-yadd-sheet

Author Dave Cooper

Description Prepares documentation for all relevant symbols in a given Lisp package.

Input slots (optional):

External-only? Boolean

Determines whether to consider all symbols in the package or just the exported ones.

Page 329: Genworks GDL: A User's Manual - Genworks International

11.23. YADD (YET ANOTHER DEFINITION DOCUMENTER (YADD)) 323

Package String or keyword symbol

Names the package, or a nickname of the package, to be documented.

Show-supported-flag boolean

Determines whether to show red/green flag on each message indicating whether it is asupported message.

Computed slots:

Strings-for-display String or List of Strings

Determines how the name of objects of this type will be printed in most places. Thisdefaults to the name-for-display (generally the part’s name as specified in its parent),followed by an index number if the part is an element of a sequence.

Title String

The title of the web page. Defaults to ”Genworks GDL -” .followed by the strings-for-display.

Objects:

Function-docs function-doc

Container for set of all Function documentation sheets.

Object-docs object-doc

Container for set of all Object documentation sheets.

Variable-docs variable-doc

Container for set of all Parameter/Variable/Constant documentation sheets.

Hidden objects:

Package-form package-form

Allows user to modify toplevel optional-inputs.

Gdl functions:

Dom-section List in GDL dom authoring format

Suitable for filling in a section of output document.

Write-html-sheet Void

Prints to *html-stream* a bulleted list for each of the three categories of docs in thepackage.

• package-form

Mixins: base-yadd-sheet

Author Dave Cooper (Genworks)

Page 330: Genworks GDL: A User's Manual - Genworks International

324 CHAPTER 11. REFERENCE FOR GDL OBJECTS AND OPERATORS

Description Presents a form to the user to be able to modify the Package, supported-flag,and external flag.

Gdl functions:

Write-html-sheet Void

This GDL function should be redefined to generate the HTML page corresponding tothis object. It can be specified here, or as the main-sheet output-function in an html-format lens for this object’s type. This write-html-sheet function, if defined, willoverride any main-sheet function defined in the lens. Typically a write-html-sheet

function would look as follows:

Page 331: Genworks GDL: A User's Manual - Genworks International

Bibliography

[1] G. LaRocca Knowledge based engineering: Between AI and CAD. Review of a language basedtechnology to support engineering design Advanced Engineering Informatics 26 (2012) 159-179,Elsevier.

325

Page 332: Genworks GDL: A User's Manual - Genworks International

Index

*3d-approximation-tolerance-default*, 318

*3d-tolerance-default*, 318

*angle-tolerance-radians-default*, 318

*approximation-tolerance-factor*, 318

*boolean-allow-multiple-regions?*, 318

*boolean-error-on-invalid-brep?*, 318

*boolean-operation-tolerance-default*, 318

*break-leaders?*, 171

*break-on-set-self?*, 202

*brep-isos-default*, 319

*brep-tolerance-default*, 319

*bypass-security-check?*, 203

*chain-beziers-for-display?*, 319

*color-plist*, 101

*color-table*, 102

*color-table-decimal*, 102

*colors-default*, 102

*compile-circular-reference-detection?*, 102

*compile-dependency-tracking?*, 102

*compile-documentation-database?*, 102

*compile-for-dgdl?*, 102

*compile-source-code-database?*, 102

*crease-angle-default*, 319

*curve-chords*, 102

*developing?*, 203

*display-tolerance*, 319

*ensure-lists-when-bashing?*, 102

*ent*, 203

*failed-request-url*, 203

*finalize-lofted-surfaces?*, 319

*gs-graphics-alpha-bits*, 171

*gs-text-alpha-bits*, 172

*hash-transforms?*, 172

*include-vrml-normals?*, 319

*instance-finalizers*, 203

*instance-hash-table*, 203

*isos-default*, 319

*jump-to-toplevel-on-set-self?*, 203

*load-documentation-database?*, 102

*load-source-code-database?*, 102

*max-id-value*, 203

*on-syntax-error*, 102

*out-of-bounds-sequence-reference-action*, 102

*output-units-default*, 319

*query*, 203

*reap-expired-sessions?*, 203

*recovery-url-default*, 203

*remember-previous-slot-values?*, 102

*req*, 203

*root-checking-enabled?*, 102

*run-with-circular-reference-detection?*, 102

*run-with-dependency-tracking?*, 102

*separate-brep-faces-for-vrml?*, 319

*sort-children?*, 102

*tess-max-3d-edge-factor*, 319

*tess-max-angle-degrees*, 319

*tess-max-aspect-ratio*, 319

*tess-max-chord-height*, 319

*tess-min-3d-edge*, 319

*tess-min-edge-ratio-uv*, 319

*tess-min-number-of-segments*, 319

*tess-min-parametric-ratio*, 319

*undeclared-parameters-enabled?*, 102

*with-format-direction, 102

*with-format-element-type*, 102

*with-format-external-format*, 102

*with-format-if-does-not-exist*, 102

*with-format-if-exists*, 102

*zero-epsilon*, 102

*zero-vector-checking?*, 172

326

Page 333: Genworks GDL: A User's Manual - Genworks International

INDEX 327

+phi+, 102

+postnet-bits+, 172

:size, 34

2pi, 102

3d-approximated, 203

3d-approximation-tolerance [planar-section-curve],285

3d-approximation-tolerance [planar-section-curves],285

3d-approximation-tolerance-achieved [planar-section-curves], 287

3d-box [renderer-mixin], 153

3d-box-center [renderer-mixin], 153

3d-curve, 204

3d-distance, 164

3d-vector-to-array, 164

Acceleration [curve], 242

Accept [base-form-control], 178

Accesskey [base-form-control], 178

Achieved-tolerance [approximated-curve], 205

acosd, 164

Adaptive-tolerance [brep], 226

add-matrices, 164

add-vectors, 165

Additional-header-content [base-ajax-sheet], 175

Additional-header-js [base-yadd-sheet], 322

Additional-header-js-content [base-ajax-sheet], 175

Additional-header-js-content [master-index], 322

After-present

[base-html-sheet], 184

After-set

[base-html-sheet], 184

Aggregate [vanilla-mixin*], 87

AJAX, 69

Ajax-submit-on-change? [base-form-control], 178

Ajax-submit-on-enter? [base-form-control], 178

Align [base-form-control], 178

alignment, 165

alist2plist, 91

All-mixins [vanilla-mixin*], 88

Allow-invalid-type? [base-form-control], 178

Allow-invalid? [base-form-control], 178

Allow-multiple-regions? [boolean-merge], 215

Allow-nil? [base-form-control], 178

Alpha [cardinal-spline], 229

Alt [base-form-control], 178

always, 91

angle-between-vectors, 165

angle-between-vectors-d, 165

Angle-tolerance [boolean-merge], 215

Angle-tolerance [brep-intersect], 228

Angle-tolerance-radians [planar-section-curve], 285

Angle-tolerance-radians [planar-section-curves], 285

Angle-tolerance-radians [projected-curve], 289

Angle-tolerance-radians-achieved [planar-section-curves], 287

angular-dimension, 103

Annotation-objects [base-view], 112

append-elements, 91

Append-error-string? [base-form-control], 178

application-mixin, 172

apply-make-point, 165

approximated-curve, 205

Approximation-tolerance [boolean-tolerance-mixin],216

Approximation-tolerance [brep-intersect], 228

Approximation-tolerance [offset-surface], 282

Approximation-tolerance [projected-curve], 289

Approximation-tolerance-adaptive [boolean-tolerance-mixin], 216

Approximation-tolerance-factor [boolean-tolerance-mixin], 216

arc, 105

Arc [revolved-surface], 296

Arc [revolved-surfaces], 296

Arc [torus], 162

arc-curve, 207

Arc-object [angular-dimension], 104

arcoid-mixin, 106

Area [brep], 227

Area [circle], 121

Area [face], 261

Area [surface], 308

Area-moments-of-inertia [brep], 227

Area-moments-of-inertia [face], 261

Area-products-of-inertia [brep], 227

Area-products-of-inertia [face], 261

Area-second-moment-about-coordinate-axii [brep],227

Page 334: Genworks GDL: A User's Manual - Genworks International

328 INDEX

Area-second-moment-about-coordinate-axii [face],261

Area-static-moments [brep], 227

Area-static-moments [face], 261

array-to-3d-vector, 165

array-to-list, 166

Arrowhead-length [label], 140

Arrowhead-length [leader-line], 143

Arrowhead-length [linear-dimension], 145

Arrowhead-style [label], 140

Arrowhead-style [leader-line], 143

Arrowhead-style [linear-dimension], 145

Arrowhead-style-2 [label], 140

Arrowhead-style-2 [leader-line], 143

Arrowhead-style-2 [linear-dimension], 145

Arrowhead-width [label], 140

Arrowhead-width [leader-line], 143

Arrowhead-width [linear-dimension], 145

asind, 166

assembly, 320

atand, 166

Available-image-formats [layout-mixin], 188

Axis-length [spherical-cap], 158

Axis-point [revolved-surface], 296

Axis-point [revolved-surfaces], 296

Axis-vector [base-object], 111

Axis-vector [extruded-solid], 260

Axis-vector [revolved-surface], 296

Axis-vector [revolved-surfaces], 296

b-spline-curve, 207

B-spline-data [curve], 242

B-spline-data [surface], 308

b-spline-surface, 210

Background-color [base-ajax-graphics-sheet], 172

Background-color [base-html-graphics-sheet], 183

base-ajax-graphics-sheet, 172

base-ajax-sheet, 174

base-coordinate-system, 107

base-drawing, 107

base-form-control, 177

base-html-graphics-sheet, 182

base-html-sheet, 184

base-object, 109

Base-plane-normal [horizontal-dimension], 139

Base-plane-normal [linear-dimension], 145

Base-plane-normal [parallel-dimension], 148

Base-plane-normal [vertical-dimension], 164

Base-radius [spherical-cap], 158

base-rule-object, 84

base-view, 112

base-yadd-sheet, 321

base64-decode-list, 200

base64-decode-safe, 200

base64-encode-list, 200

base64-encode-safe, 200

Bashee [skeleton-ui-element], 196

Basic Lisp Techniques, 4

basic-surface, 212

Basis [trimmed-curve], 315

Basis-surface [circular-surface], 232

Basis-surface [face], 260

Basis-surface [trimmed-surface], 315

Before-present

[base-html-sheet], 184

Before-response

[base-html-sheet], 184

Before-set

[base-html-sheet], 184

bezier-curve, 115

Bin-subdir-names [codebase-directory-node], 83

blended-solid, 212

Body-bgcolor [layout-mixin], 188

Body-class [base-ajax-sheet], 175

Body-onload [base-ajax-sheet], 175

Body-onpageshow [base-ajax-sheet], 175

boolean-merge, 215

boolean-tolerance-mixin, 216

Border-box? [base-view], 114

Bottom-cap? [cylinder], 125

Bounding-bbox [base-object], 111

Bounding-box [base-object], 109

Bounding-box [bezier-curve], 115

Bounding-box [brep], 226

Bounding-box [curve], 241

Bounding-box [face], 260

Bounding-box [fitted-surface], 266

Bounding-box [global-polygon-projection], 137

Bounding-box [global-polyline-mixin], 139

Bounding-box [line], 145

Page 335: Genworks GDL: A User's Manual - Genworks International

INDEX 329

Bounding-box [point], 152

Bounding-box [route-pipe], 155

Bounding-box [surface], 307

Bounding-sphere [renderer-mixin], 153

box, 117

box-solid, 216

boxed-curve, 216

boxed-surface, 220

Break-points [leader-line], 143

brep, 223

Brep [blended-solid], 212

Brep [boolean-merge], 216

Brep [brep-intersect], 228

Brep [face], 260

Brep [manifold-solid], 279

Brep [offset-solid], 281

Brep [planar-section-curves], 287

Brep [regioned-solid], 294

Brep [shelled-solid], 300

Brep [surface], 308

Brep [transformed-solid], 310

Brep [trimmed-surface], 317

brep-intersect, 228

Brep-intersect? [brep], 227

Brep-tolerance [brep], 224

Brep-tolerance [extruded-solid], 260

Brep-tolerance [surface], 306

Breps [iges-reader], 271

Breps [native-reader], 280

Breps [separated-solid], 300

Breps [step-reader], 305

Built-from [brep], 224

Built-from [curve], 240

Built-from [dropped-curve], 249

Built-from [projected-curve], 291

Built-from [surface], 306

Built-from [trimmed-curve], 315

Button-color [tree], 320

c-cylinder, 117

C11? [fitted-surface], 265

Caching, 1

cad-assembly, 228

Cap-results? [separated-solid], 299

Cap-thickness [spherical-cap], 158

cardinal-spline, 229

Center [base-object], 109

Center [base-view], 114

Center [boxed-curve], 219

Center [boxed-surface], 222

Center [c-cylinder], 119

Center [cad-assembly], 229

Center [constrained-arc], 124

Center [general-note], 129

Center [line], 145

Center [rectangular-surface], 293

Center [revolved-surface], 296

Center [spherical-surface], 302

Center [text-line], 160

Center [typeset-block], 162

Center [web-drawing], 200

center-line, 119

Center-line [c-cylinder], 119

Center-of-gravity [brep], 227

Center-point [angular-dimension], 104

Character-size [general-note], 129

Character-size [label], 140

Character-size [linear-dimension], 146

check-computed-slots, 91

Check-continuity [curve], 242

check-documentation, 91

check-floating-string, 92

check-form, 92

check-functions, 92

check-input-slots, 92

check-objects, 92

check-query-slots, 92

Check-sanity [base-html-sheet], 185

Check-sanity? [base-html-sheet], 184

check-trickle-down-slots, 92

checkbox-form-control, 186

Children [vanilla-mixin*], 88

Choice-list [menu-form-control], 192

Choice-plist [menu-form-control], 192

Choice-styles [menu-form-control], 192

circle, 121

Circle-intersection-2d [bezier-curve], 117

Circle? [center-line], 121

circular-curve, 230

circular-surface, 230

Page 336: Genworks GDL: A User's Manual - Genworks International

330 INDEX

Circumference [circle], 121

cl-lite, 92

cl-patch, 84

Class [skeleton-form-control], 195

clear-all-instances, 200

Clear-expired-session [session-control-mixin], 194

clear-instance, 200

Clear-now? [session-control-mixin], 194

clear-old-timers, 201

Closed? [cylinder], 127

Closed? [global-filleted-polyline-mixin], 135

Closure [curve], 242

codebase-directory-node, 83

Coincident-point-tolerance [composed-curve], 235

Coincident-point-tolerance [composed-curves], 235

coincident-point?, 166

Color-decimal [base-object], 111

Color-decimal [geometry-kernel-object-mixin], 269

color-map, 187

Cols [text-form-control], 198

Common Lisp, 4

compatible-curves, 232

compatible-surfaces, 233

compiled language

benefits of, 5

composed-curve, 233

composed-curves, 235

Composed-edges [brep], 226

computed-slots, 30

cone, 123

cone-solid, 237

conic-curve, 237

constrained-arc, 123

constrained-fillet, 124

constrained-line, 125

containment

object, 32

Continuity [extended-curve], 254

Continuity [extended-surface], 259

Control-points [3d-curve], 204

Control-points [b-spline-curve], 207

Control-points [b-spline-surface], 210

Control-points [bezier-curve], 115

Control-points [boxed-curve], 220

Control-points [boxed-surface], 223

Control-points [general-dual-blend-surface], 268

Control-points [redirected-surface], 293

Corner [base-view], 114

crawl, 201

Create-fasl? [codebase-directory-node], 83

create-obliqueness, 166

cross-vectors, 166

Crosshair-length [point], 151

Curvature [curve], 242

curve, 240

Curve [extended-surface], 257

Curve [revolved-surface], 296

Curve-1 [general-dual-blend-surface], 266

Curve-1 [ruled-surface], 299

Curve-1-uv [edge-blend-surface], 252

Curve-2 [general-dual-blend-surface], 266

Curve-2 [ruled-surface], 299

Curve-2-uv [edge-blend-surface], 252

Curve-bottom [basic-surface], 212

Curve-in [3d-approximated], 204

Curve-in [approximated-curve], 205

Curve-in [boxed-curve], 219

Curve-in [decomposed-curves], 247

Curve-in [dropped-curve], 247

Curve-in [extended-curve], 254

Curve-in [non-rational-curve], 280

Curve-in [normalized-curve], 281

Curve-in [planar-offset-curve], 282

Curve-in [projected-curve], 289

Curve-intersection-point [curve], 242

Curve-intersection-point [surface], 308

Curve-intersection-points [curve], 242

Curve-intersection-points [surface], 308

Curve-left [basic-surface], 212

Curve-list [compatible-curves], 233

Curve-right [basic-surface], 212

Curve-side-1 [edge-blend-surface], 252

Curve-side-2 [edge-blend-surface], 252

Curve-top [basic-surface], 212

Curves [compatible-curves], 233

Curves [composed-curve], 235

Curves [composed-curves], 235

Curves [decomposed-curves], 247

Curves [global-filleted-polyline-curve], 269

Curves [iges-reader], 271

Page 337: Genworks GDL: A User's Manual - Genworks International

INDEX 331

Curves [lofted-surface], 276

Curves [native-reader], 280

Curves [planar-section-curves], 287

Curves [revolved-surfaces], 296

Curves [step-reader], 305

Curves-in [composed-curves], 235

Custom-snap-restore

[base-ajax-sheet], 177

cyclic-nth, 93

cylinder, 125

cylinder-solid, 245

Data [pie-chart], 149

declarative, 5

decomposed-curves, 245

Default [base-form-control], 178

Default [grid-form-control], 187

Default-header-content [base-yadd-sheet], 322

Default-radius [blended-solid], 212

Default-radius [global-filleted-polygon-projection],132

Default-radius [global-filleted-polyline-mixin], 135

Default-tree-depth [node-mixin], 192

defaulting, 93

define-format, 93

define-lens, 93

Define-object, 30

define-object, 93

define-object-amendment, 93

Deformation-param [extended-surface], 259

degree, 166

Degree [3d-curve], 204

Degree [b-spline-curve], 207

Degree [boxed-curve], 220

Degree [fitted-curve], 263

degrees-to-radians, 166

Delete

[variable-sequence], 91

Density [brep], 225

Dependency tracking, 1

Description-position [radio-form-control], 193

Development-links [base-ajax-sheet], 177

Digitation-mode [base-html-graphics-sheet], 183

Dim-text [linear-dimension], 146

Dim-text-bias [linear-dimension], 146

Dim-text-start [angular-dimension], 104

Dim-text-start [horizontal-dimension], 139

Dim-text-start [linear-dimension], 146

Dim-text-start [parallel-dimension], 148

Dim-text-start [vertical-dimension], 163

Dim-text-start-offset [linear-dimension], 146

Dim-value [angular-dimension], 105

Dim-value [linear-dimension], 146

Direct-mixins [vanilla-mixin*], 88

Direction [extended-surface], 259

Direction [joined-surfaces], 274

Direction [ruled-surface], 299

Direction [surface-knot-reduction], 310

Direction-vector [curve], 241

Direction-vector [cylinder], 127

Direction-vector [line], 145

Disabled-keys [menu-form-control], 192

Disabled? [base-form-control], 178

Display-controls [base-object], 109

Display-controls [cad-assembly], 229

Display-controls [leader-line], 143

Display-iso-curves-wireframe? [brep], 225

Display-list-object-roots [base-ajax-graphics-sheet],172

Display-list-objects [base-ajax-graphics-sheet], 172

Display-rules? [layout-mixin], 190

Display-tessellation-lines-wireframe? [brep], 225

Display-tree? [layout-mixin], 190

Distance [extended-curve], 254

Distance [extruded-solid], 260

Distance [offset-solid], 281

Distance [offset-surface], 281

Distance [planar-offset-curve], 282

Distance [shelled-solid], 300

Distance [swept-solid], 310

Distance-to-create-line [composed-curve], 235

Distance-to-create-line [composed-curves], 235

distance-to-line, 166

Distance-type [extended-curve], 257

div, 94

Doctype-string [base-ajax-sheet], 175

Documentation [vanilla-mixin*], 89

Dom-id [skeleton-ui-element], 196

Dom-section [package-dokumentation], 323

Domain [base-form-control], 180

Page 338: Genworks GDL: A User's Manual - Genworks International

332 INDEX

Domain [checkbox-form-control], 186

Domain [surface], 308

dot-vectors, 166

Draw-centerline-arc? [torus], 160

dropped-curve, 247

Dropped-curve [curve], 243

Dropped-height-width [base-ajax-graphics-sheet],173

Dropped-object [base-ajax-graphics-sheet], 173

Dropped-point [curve], 243

Dropped-point [surface], 308

Dropped-points [surface], 308

Dropped-x-y [base-ajax-graphics-sheet], 174

dual-blend-surface, 249

Dxf-font [general-note], 129

Dxf-font [label], 140

Dxf-font [linear-dimension], 146

Dxf-offset [general-note], 129

Dxf-offset [label], 142

Dxf-offset [linear-dimension], 146

Dxf-size-ratio [general-note], 129

Dxf-size-ratio [label], 142

Dxf-size-ratio [linear-dimension], 146

Dxf-text-x-scale [general-note], 129

Dxf-text-x-scale [label], 142

Dxf-text-x-scale [linear-dimension], 146

edge, 251

edge-blend-surface, 252

Edge-center [base-object], 111

Edges [brep], 226

Edges [face], 261

Edges-sequence [brep], 226

ellipse, 127

elliptical-curve, 252

End [arc], 106

End [c-cylinder], 119

End [constrained-line], 125

End [curve], 241

End [cylinder], 127

End [line], 143

End [linear-curve], 276

End-angle [arc], 106

End-angle [arcoid-mixin], 107

End-angle [circle], 121

End-angle [constrained-fillet], 125

End-angle [ellipse], 129

End-angle [spherical-cap], 159

End-caps-on-brep? [surface], 306

End-caps? [torus], 160

End-horizontal-arc [sphere], 157

End-point [angular-dimension], 104

End-point [conic-curve], 237

End-point [linear-dimension], 145

End-tangent [conic-curve], 237

End-vertical-arc [sphere], 157

ensure-list, 94

equi-space-points, 166

Equi-spaced-parameters [curve], 243

Equi-spaced-points [arc], 106

Equi-spaced-points [curve], 243

Error [base-form-control], 182

Error-on-invalid? [boolean-merge], 216

Expires-at [session-control-mixin], 194

extended-curve, 254

extended-surface, 257

Extending-from [extended-curve], 257

External-only? [assembly], 321

External-only? [package-dokumentation], 322

extruded-solid, 259

F-ratio-1 [general-dual-blend-surface], 266

F-ratio-2 [general-dual-blend-surface], 268

F-tangent-1 [dual-blend-surface], 249

F-tangent-1 [edge-blend-surface], 252

F-tangent-1 [general-dual-blend-surface], 266

F-tangent-2 [dual-blend-surface], 251

F-tangent-2 [edge-blend-surface], 252

F-tangent-2 [general-dual-blend-surface], 266

face, 260

Face-brep-colors [brep], 224

Face-breps [brep], 226

Face-center [base-object], 112

Face-normal-vector [base-object], 112

Face-vertices [base-object], 112

Faces [brep], 226

Faces [edge], 251

Faces-in [stitched-solid], 306

Facial-brep [swept-solid], 310

Failed-form-controls [skeleton-ui-element], 197

Page 339: Genworks GDL: A User's Manual - Genworks International

INDEX 333

Failed-value [base-form-control], 182

Fasl-output-name [codebase-directory-node], 83

Fasl-output-path [codebase-directory-node], 83

Fasl-output-type [codebase-directory-node], 83

Field-name [skeleton-form-control], 195

Field-of-view-default [base-ajax-graphics-sheet],172

Field-of-view-default [renderer-mixin], 153

File-name [iges-reader], 271

File-name [native-reader], 279

File-name [step-reader], 305

Fillet-curves [global-filleted-polyline-curves], 271

Fillets [global-filleted-polyline-mixin], 135

find-dependants, 94

find-dependencies, 94

find-messages-used-by, 94

find-messages-which-use, 94

First [matrix-sequence], 85

First [quantification], 86

First [standard-sequence], 87

First [variable-sequence], 91

First-derivative [curve], 242

First? [vanilla-mixin*], 88

fitted-curve, 261

fitted-surface, 263

Fixed-parameter [iso-curve], 273

flatten, 94

Flip-leaders? [linear-dimension], 146

Follow-root-path [vanilla-mixin*], 89

Font [general-note], 129

Font [label], 142

Font [linear-dimension], 146

Force-validation-for [skeleton-ui-element], 196

Foreground-color [base-html-graphics-sheet], 183

Form-control [skeleton-form-control], 195

Form-control-attributes [grid-form-control], 188

Form-control-inputs [grid-form-control], 188

Form-control-string [skeleton-form-control], 195

Form-control-types [grid-form-control], 188

Form-controls [grid-form-control], 188

Form-controls [skeleton-form-control], 195

Form-controls [skeleton-ui-element], 197

format-slot, 94

From-center [boxed-curve], 219

From-center [boxed-surface], 222

From-location [transformed-solid], 310

From-object [boxed-curve], 219

From-object [boxed-surface], 222

From-object [transformed-solid], 313

From-orientation [boxed-curve], 219

From-orientation [boxed-surface], 222

From-orientation [transformed-solid], 313

Front-margin [base-view], 114

fround-to-nearest, 94

Full-leader-line-length [linear-dimension], 146

Function-docs [package-dokumentation], 323

functions, 30

Gap-length [center-line], 121

gdl-ajax-call, 72

Gdl-ajax-call [skeleton-ui-element], 197

general-dual-blend-surface, 266

general-note, 129

geometry-kernel-object-mixin, 268

geometry-view-mixin, 187

get-point-on-curve, 318

get-point-on-other-curve, 318

get-point-on-surface, 318

get-u, 167

get-v, 167

get-w, 167

get-x, 167

get-y, 167

get-z, 167

global-filleted-polygon-projection, 132

global-filleted-polyline, 132

global-filleted-polyline-curve, 269

global-filleted-polyline-curves, 269

global-filleted-polyline-mixin, 132

global-polygon-projection, 135

global-polyline, 137

global-polyline-mixin, 137

Global-to-local [base-object], 112

Graphics [base-ajax-graphics-sheet], 174

Graphics-height [layout-mixin], 190

Graphics-width [layout-mixin], 190

grid-form-control, 187

Group-trimmed-surfaces-into-brep? [iges-reader],271

Page 340: Genworks GDL: A User's Manual - Genworks International

334 INDEX

Group-trimmed-surfaces-into-brep? [step-reader],305

gwl-make-object, 201gwl-rule-object, 188

half, 95hat-2, 101Header-plist [base-html-sheet], 185Height [arc], 106Height [base-drawing], 107Height [base-object], 111Height [boxed-curve], 220Height [boxed-surface], 223Height [center-line], 121Height [cone], 123Height [cylinder], 127Height [ellipse], 129Height [general-note], 131Height [layout-mixin], 188Height [rectangular-surface], 291Height [route-pipe], 155Height [sphere], 157Height [spherical-cap], 159Height [spiral-curve], 302Height [surface], 307Height [torus], 162Hidden-children [vanilla-mixin*], 88Hidden? [vanilla-mixin*], 87Hide-edges? [brep-intersect], 228Hide-points? [brep-intersect], 228Holes [trimmed-surface], 315Hollow? [cylinder], 127horizontal-dimension, 139Html-sections [skeleton-ui-element], 196Html-string [skeleton-form-control], 195

Id [skeleton-form-control], 195Iges-level [geometry-kernel-object-mixin], 269iges-reader, 271Ignorance-based Engineering, 1ignore-errors-with-backtrace, 95Image-file [base-object], 109Image-file [web-drawing], 200Image-format [base-ajax-graphics-sheet], 173Image-format [base-html-graphics-sheet], 183Image-format [layout-mixin], 189

Image-format-default [base-ajax-graphics-sheet],173

Image-format-plist [base-ajax-graphics-sheet], 173

Image-format-selector [base-ajax-graphics-sheet],174

Immune-objects [base-ajax-graphics-sheet], 173

Immune-objects [base-view], 114

Immune-objects [web-drawing], 198

Imported-assembly [cad-assembly], 229

In-face? [base-object], 112

In-plane? [curve], 243

In? [brep], 227

Include-delete-buttons? [grid-form-control], 188

Include-legend? [pie-chart], 149

Include-view-controls? [base-ajax-graphics-sheet],173

Index [vanilla-mixin*], 88

index-filter, 95

Inner-base-radius [spherical-cap], 158

Inner-html [base-ajax-graphics-sheet], 173

Inner-html [newertree], 320

Inner-html [skeleton-ui-element], 196

Inner-minor-radius [torus], 160

Inner-pipe-radius [route-pipe], 155

Inner-radius [cylinder], 127

Inner-radius [sphere], 157

Inner-radius-1 [cone], 123

Inner-radius-2 [cone], 123

input-slots, 30

Inputs-bgcolor [layout-mixin], 189

Inputs-title [layout-mixin], 189

Insert

[variable-sequence], 91

inter-circle-sphere, 167

inter-line-plane, 167

inter-line-sphere, 167

Interpolant? [fitted-curve], 263

Interpolant? [fitted-surface], 265

intersected-solid, 272

Island [circular-surface], 232

Island [trimmed-surface], 315

Ismap? [base-form-control], 180

iso-8601-date, 95

iso-curve, 272

Isos [brep], 225

Page 341: Genworks GDL: A User's Manual - Genworks International

INDEX 335

Isos [surface], 307

joined-surfaces, 273Js-to-eval [base-ajax-graphics-sheet], 174Js-to-eval [skeleton-ui-element], 196Justification [general-note], 131Justification [linear-dimension], 146

Keep-internal-faces? [manifold-solid], 279Keep-side [split-surface], 304Knot-vector [3d-curve], 204Knot-vector [b-spline-curve], 210Knot-vector [boxed-curve], 220Knowledge Base System, 1

label, 139Label-position [base-form-control], 180Labels&colors [pie-chart], 149Lang [base-form-control], 180Last [matrix-sequence], 85Last [quantification], 86Last [standard-sequence], 87Last [variable-sequence], 91Last? [vanilla-mixin*], 88lastcar, 95Layer [geometry-kernel-object-mixin], 269layout-mixin, 188Leader-1? [linear-dimension], 146Leader-2? [linear-dimension], 146Leader-direction-1-vector [horizontal-dimension],

139Leader-direction-1-vector [linear-dimension], 145Leader-direction-1-vector [parallel-dimension], 148Leader-direction-1-vector [vertical-dimension], 164Leader-direction-2-vector [horizontal-dimension],

139Leader-direction-2-vector [linear-dimension], 145Leader-direction-2-vector [parallel-dimension], 148Leader-direction-2-vector [vertical-dimension], 164leader-line, 142Leader-line-length [linear-dimension], 147Leader-line-length-2 [linear-dimension], 147Leader-path [label], 140Leader-radius [angular-dimension], 104Leader-text-gap [linear-dimension], 147Leading [general-note], 131

Leaf? [vanilla-mixin*], 88

least, 95

Leaves [vanilla-mixin*], 88

Left-margin [base-view], 114

Length [arc], 106

Length [base-drawing], 107

Length [base-object], 111

Length [boxed-curve], 220

Length [boxed-surface], 223

Length [c-cylinder], 119

Length [center-line], 121

Length [cylinder], 125

Length [ellipse], 129

Length [general-note], 131

Length [geometry-view-mixin], 187

Length [layout-mixin], 189

Length [line], 145

Length [rectangular-surface], 291

Length [route-pipe], 155

Length [sphere], 157

Length [spherical-cap], 159

Length [surface], 307

Length [text-line], 160

Length [torus], 162

Length [typeset-block], 162

Length-default [typeset-block], 163

length-vector, 168

Levels [geometry-kernel-object-mixin], 269

line, 143

Line-color [pie-chart], 149

Line-intersection-2d [bezier-curve], 117

Line-intersection-points [base-object], 112

linear-curve, 275

linear-dimension, 145

Lines [global-polyline-mixin], 139

Lines [typeset-block], 163

list-elements, 95

list-of-n-numbers, 95

list-of-numbers, 95

Load-always? [codebase-directory-node], 83

load-quicklisp, 96

Local-bbox [base-object], 111

Local-bounding-box [curve], 243

Local-bounding-box [surface], 308

Local-box [base-object], 109

Page 342: Genworks GDL: A User's Manual - Genworks International

336 INDEX

Local-box [brep], 226

Local-center [base-object], 111

Local-center* [base-object], 111

Local-orientation [base-object], 111

Local-to-global [base-object], 112

Local? [b-spline-curve], 210

Local? [fitted-curve], 263

lofted-surface, 276

Long-segment-length [center-line], 121

macros

code-expanding, 5

Main-div% [skeleton-ui-element], 197

Main-sheet-body [assembly], 321

Main-sheet-body [base-ajax-sheet], 175

Main-sheet-body [master-index], 322

Main-view [web-drawing], 200

Maintain-end-tangents? [non-rational-curve], 280

Major-axis-length [ellipse], 127

Major-radius [torus], 160

Make-all-surfaces-trimmed? [iges-reader], 271

Make-all-surfaces-trimmed? [step-reader], 305

make-instance, 31

make-keyword, 96

Make-manifold? [merged-solid], 279

make-object, 31, 96

make-point, 168

Make-single-brep? [iges-reader], 271

Make-single-brep? [step-reader], 305

make-transform, 168

make-vector, 168

manifold-solid, 278

mapsend, 96

maptree, 96

Mass [brep], 227

master-index, 322

Master-index [assembly], 321

Match-parameterization? [approximated-curve],205

matrix*vector, 168

matrix-sequence, 85

matrix-to-quaternion, 168

Max-3d-edge [brep], 225

Max-3d-edge-factor [brep], 225

Max-angle-degrees [brep], 225

Max-aspect-ratio [brep], 225

Max-chord-height [brep], 225

max-of-elements, 96

Maximum-distance-to-curve [curve], 243

Maximum-distance-to-curve [surface], 308

Maximum-distance-to-point [curve], 243

Maximum-distance-to-surface [surface], 309

Maximum-text-width [general-note], 132

Maxlength [base-form-control], 180

menu-form-control, 191

merge-display-controls, 168

merged-solid, 279

Mesh-data [poly-brep], 288

Message-documentation [vanilla-mixin*], 89

Message-list [vanilla-mixin*], 89

midpoint, 168

Min-3d-edge [brep], 225

Min-edge-ratio-uv [brep], 225

Min-max-x-y-z [brep], 226

Min-number-of-segments [brep], 225

min-of-elements, 96

Min-parametric-ratio [brep], 225

Minimum-distance-to-curve [curve], 243

Minimum-distance-to-curve [surface], 309

Minimum-distance-to-point [curve], 243

Minimum-distance-to-surface [surface], 309

Minimum-radius [curve], 243

Minor-axis-length [ellipse], 127

Minor-radius [torus], 160

mixin-list, 30

Mixins [vanilla-mixin*], 89

Model-point [base-view], 115

Moments [brep], 227

Moments [face], 261

most, 97

Multipart-form? [layout-mixin], 189

Multiple? [menu-form-control], 192

Multiple? [radio-form-control], 193

multiply-matrices, 168

N-segments [general-dual-blend-surface], 268

Name-for-display [vanilla-mixin*], 88

native-reader, 279

near-to?, 97

near-zero?, 97

Page 343: Genworks GDL: A User's Manual - Genworks International

INDEX 337

never, 97

newertree, 319

Next [vanilla-mixin*], 88

node-mixin, 192

Node-ui-display-list-objects [node-mixin], 192

non-rational-curve, 280

Non-rational-degree [non-rational-curve], 280

Normal [curve], 243

Normal [surface], 309

normalized-curve, 280

Normals [fitted-surface], 265

null-object, 86

Nullify-empty-string? [base-form-control], 180

number-format, 97

Number-of-horizontal-sections [sphere], 157

Number-of-horizontal-sections [spherical-cap], 159

Number-of-longitudinal-sections [torus], 162

Number-of-samples [3d-approximated], 204

Number-of-sections [cylinder], 127

Number-of-transverse-sections [torus], 162

Number-of-turns [spiral-curve], 302

Number-of-vertical-sections [sphere], 157

Number-of-vertical-sections [spherical-cap], 159

number-round, 97

Number? [text-form-control], 198

object sequences, 34

Object-docs [package-dokumentation], 323

object-orientation

generic-function, 5

message-passing, 5

Object-roots [base-view], 114

Object-roots [renderer-mixin], 152

Object-roots [web-drawing], 198

Objects

sequenced, 34

objects, 30, 32

child, 32

contained, 32

defining, 30

Objects [base-view], 114

Objects [renderer-mixin], 152

Objects [web-drawing], 198

Obliqueness [base-object], 109

Offset [global-polygon-projection], 136

Offset-point [surface], 309

Offset-point-along [curve], 243

offset-solid, 281

offset-surface, 281

On-surfaces [curve], 241

On-surfaces [iso-curve], 273

On-surfaces [planar-section-curve], 285

On? [curve], 244

On? [surface], 309

Onblur [base-form-control], 180

Onchange [base-form-control], 180

Onclick [base-form-control], 180

Onclick-function [base-object], 109

Onclick-function [newertree], 320

Onclick-function [tree], 320

Ondblclick [base-form-control], 180

Onenter [base-form-control], 180

Onfocus [base-form-control], 180

Onkeydown [base-form-control], 180

Onkeypress [base-form-control], 180

Onkeyup [base-form-control], 180

Onmousedown [base-form-control], 181

Onmousemove [base-form-control], 181

Onmouseout [base-form-control], 181

Onmouseover [base-form-control], 181

Onmouseup [base-form-control], 181

Onselect [base-form-control], 181

Ordered-curves [global-filleted-polyline-curves], 269

Ordered-form-controls [skeleton-ui-element], 197

Org-type [session-control-mixin], 194

Orientation [base-object], 111

Orientation [boxed-curve], 219

Orientation [boxed-surface], 222

Orientation [c-cylinder], 119

Orientation [cad-assembly], 229

Orientation [constrained-arc], 124

Orientation [label], 142

Orientation [linear-dimension], 147

Orientation [route-pipe], 155

Orientation-center [boxed-curve], 219

Orientation-center [boxed-surface], 222

orthogonal-component, 168

Other-brep [boolean-merge], 215

Other-brep [brep-intersect], 228

Other-rules [layout-mixin], 189

Page 344: Genworks GDL: A User's Manual - Genworks International

338 INDEX

Other-rules-bgcolor [layout-mixin], 189

Other-rules-title [layout-mixin], 189

Other-surface [joined-surfaces], 274

Outer-pipe-radius [route-pipe], 153

Outline-shape-type [general-note], 131

Outline-shape-type [label], 142

Outline-shape-type [linear-dimension], 147

Outside-leaders-length-factor [linear-dimension],147

Outside-leaders? [linear-dimension], 147

P00 [planar-surface], 288

P00 [rectangular-surface], 293

P01 [planar-surface], 288

P01 [rectangular-surface], 293

P10 [planar-surface], 288

P10 [rectangular-surface], 293

P11 [planar-surface], 288

P11 [rectangular-surface], 293

Package [package-dokumentation], 323

package-dokumentation, 322

Package-dokumentations [assembly], 321

package-form, 323

Package-form [package-dokumentation], 323

Packages-to-ignore [assembly], 321

Page-length [base-drawing], 107

Page-length [sample-drawing], 156

Page-title [layout-mixin], 189

Page-width [base-drawing], 107

Page-width [sample-drawing], 156

parallel-dimension, 148

parallel-vectors?, 169

Parameter [iso-curve], 272

Parameter [split-surface], 304

Parameter-at-length [curve], 244

Parameter-at-point [curve], 244

Parameter-bounds [curve], 244

Parameterization [cardinal-spline], 229

Parameterization [fitted-curve], 263

Parameterization [fitted-surface], 265

Parameterization [non-rational-curve], 280

Parameterization [offset-surface], 282

Parent [vanilla-mixin*], 88

Password? [text-form-control], 198

Path-points [leader-line], 142

pi/2, 102

pie-chart, 149

Pinned-parameters [approximated-curve], 205

Placeholder [base-form-control], 181

planar-offset-curve, 282

planar-section-curve, 282

planar-section-curves, 285

planar-surface, 288

Plane-intersection-point [curve], 244

Plane-intersection-points [curve], 244

Plane-normal [planar-offset-curve], 282

Plane-normal [planar-section-curve], 285

Plane-normal [planar-section-curves], 287

Plane-point [planar-section-curve], 285

Plane-point [planar-section-curves], 287

plist-keys, 97

plist-values, 97

point, 151

Point [bezier-curve], 117

Point [curve], 244

Point [surface], 309

Point [uv-iso-curve], 318

Point-on-arc [arc], 106

Point-on-curve [conic-curve], 237

Points [fitted-curve], 263

Points [fitted-surface], 265

Points [iges-reader], 272

Points [step-reader], 305

poly-brep, 288

Poly-brep [brep], 226

Poly-brep-smooth-results? [brep], 226

Possible-nil? [checkbox-form-control], 187

Possible-nil? [menu-form-control], 192

Possible-nils [skeleton-ui-element], 197

Precise-properties [brep], 227

Precise-properties [face], 261

Precise-properties-plist [brep], 227

Preset-all? [skeleton-ui-element], 197

Preset? [base-form-control], 181

Previous [vanilla-mixin*], 88

Primary? [skeleton-form-control], 195

print-messages, 97

print-variables, 97

Process-cookies

[base-html-sheet], 185

Page 345: Genworks GDL: A User's Manual - Genworks International

INDEX 339

Profile [extruded-solid], 259proj-point-on-line, 169projected-curve, 288Projected-point [split-surface], 304Projected-point [surface], 309Projected-points [split-surface], 304Projected-points [surface], 309projected-vector, 169Projection-depth [global-polygon-projection], 136Projection-point [split-surface], 304Projection-vector [base-ajax-graphics-sheet], 173Projection-vector [base-view], 115Projection-vector [global-polygon-projection], 137Projection-vector [projected-curve], 289Projection-vector [split-surface], 304Projection-vector [web-drawing], 198Prompt [base-form-control], 181Properties [brep], 227publish-gwl-app, 201publish-shared, 201publish-string-content, 202pythagorize, 169

quantification, 86quaternion-to-matrix, 169quaternion-to-rotation, 169query-collect, 97Query-plist [base-html-sheet], 185

radial-sequence, 86radians-to-degrees, 169radians-to-grads, 169radio-form-control, 193Radius [arc], 106Radius [arcoid-mixin], 107Radius [circular-surface], 232Radius [constrained-arc], 124Radius [cylinder], 125Radius [pie-chart], 149Radius [point], 152Radius [sphere], 156Radius-1 [cone], 123Radius-1 [spiral-curve], 302Radius-2 [cone], 123Radius-2 [spiral-curve], 302Radius-list [global-filleted-polygon-projection], 132

Radius-list [global-filleted-polyline-mixin], 135

Radius-of-curvature [curve], 244

Radius-of-curvature [surface], 309

Rail-1 [lofted-surface], 276

Rail-1-is-spine? [lofted-surface], 276

Rail-1-params [lofted-surface], 278

Rail-2 [lofted-surface], 278

Raphael-canvas-id [web-drawing], 198

Raster-graphics [base-ajax-graphics-sheet], 174

Rational? [surface], 306

read-safe-string, 98

Read-saved-slots [layout-mixin], 191

read-snapshot, 98

Readonly? [base-form-control], 181

Recovery-expires-at [session-control-mixin], 194

Recovery-url [session-control-mixin], 194

rectangular-surface, 291

redirected-surface, 293

reference chains, 32

regioned-solid, 294

Regions [brep], 226

regression tests, 10

relativize-pathname, 202

remove-plist-entry, 98

renderer-mixin, 152

Report-point [base-html-graphics-sheet], 183

Reset

[variable-sequence], 91

Respondent [base-ajax-sheet], 175

Respondent [base-html-sheet], 185

Respondent [newertree], 320

Respondent [skeleton-ui-element], 197

Respondent [tree], 320

Restore-all-defaults

[vanilla-mixin*], 89

Restore-defaults

[base-form-control], 182

Restore-form-controls

[base-html-sheet], 186

Restore-slot-default

[vanilla-mixin*], 89

Restore-slot-defaults

[vanilla-mixin*], 89

Restore-tree

[vanilla-mixin*], 89

Page 346: Genworks GDL: A User's Manual - Genworks International

340 INDEX

Result-holes [trimmed-surface], 317

Result-island [trimmed-surface], 317

Return-object [base-html-sheet], 185

Reverse-holes? [trimmed-surface], 315

Reverse-island? [trimmed-surface], 317

Reverse-u? [redirected-surface], 293

Reverse-v? [redirected-surface], 293

reverse-vector, 169

revolved-surface, 294

revolved-surfaces, 296

Right-or-left [spiral-curve], 302

roll, 169

Root [vanilla-mixin*], 87

Root-path [vanilla-mixin*], 88

Root-path-local [vanilla-mixin*], 88

Root? [vanilla-mixin*], 88

rotate-point, 170

rotate-point-d, 170

rotate-vector, 170

rotate-vector-d, 170

rotation, 170

round-to-nearest, 98

route-pipe, 153

Row-labels [grid-form-control], 188

Rows [text-form-control], 198

Rule-description [base-rule-object], 85

Rule-description-help [base-rule-object], 85

Rule-result [base-rule-object], 85

Rule-result-help [base-rule-object], 85

Rule-title [base-rule-object], 85

ruled-surface, 296

Safe-children [newertree], 320

Safe-children [vanilla-mixin*], 87

safe-float, 98

Safe-hidden-children [vanilla-mixin*], 89

safe-sort, 98

same-direction-vectors?, 170

sample-drawing, 155

Sanity-error [base-html-sheet], 186

Saved-slots [layout-mixin], 190

scalar*matrix, 170

scalar*vector, 170

Scale [boxed-curve], 219

Scale [boxed-surface], 222

Scale [transformed-solid], 313

Scale-x [boxed-curve], 219

Scale-x [boxed-surface], 222

Scale-y [boxed-curve], 220

Scale-y [boxed-surface], 223

Scale-z [boxed-curve], 220

Scale-z [boxed-surface], 223

Scaled? [point], 152

Second-derivative [curve], 242

Section-colors [regioned-solid], 294

Section-colors [separated-solid], 300

Select-choices [base-html-sheet], 186

self, 32

separated-solid, 299

sequences, 34

Session-clean-up [session-control-mixin], 194

session-control-auto-refresh, 202

session-control-mixin, 193

Session-duration [session-control-mixin], 194

session-report, 202

Set-expires-at [session-control-mixin], 194

set-format-slot, 98

Set-slot

[vanilla-mixin*], 89

Set-slots

[vanilla-mixin*], 90

Sew-and-orient-brep? [surface], 306

Sew-and-orient? [boolean-merge], 216

Sew-and-orient? [merged-solid], 279

Sew-and-orient? [transformed-solid], 313

Sew-brep-faces? [iges-reader], 271

Sew-brep-faces? [step-reader], 305

sheet-section, 194

shelled-solid, 300

Shells [brep], 226

Short-segment-length [center-line], 121

Show-box? [boxed-curve], 220

Show-box? [boxed-surface], 223

Show-control-polygon? [boxed-curve], 220

Show-control-polygon? [boxed-surface], 223

Show-supported-flag [package-dokumentation], 323

Show-tight-box? [boxed-curve], 220

Show-tight-box? [boxed-surface], 223

Show-title? [layout-mixin], 189

Shrink? [transformed-solid], 313

Page 347: Genworks GDL: A User's Manual - Genworks International

INDEX 341

Size [base-form-control], 181

Size [center-line], 121

Size [menu-form-control], 192

skeleton-form-control, 195

skeleton-ui-element, 195

Slot-documentation [vanilla-mixin*], 90

Slot-source [vanilla-mixin*], 90

Slot-status [vanilla-mixin*], 90

Smlib-string [native-reader], 279

Snap-to [base-view], 115

sort-points-along-vector, 170

Source-files-to-ignore [codebase-directory-node],84

Special-subdir-names [codebase-directory-node],84

specification-plist, 30

Specs [blended-solid], 215

sphere, 156

Sphere-center [spherical-cap], 159

Sphere-radius [spherical-cap], 159

spherical-cap, 158

spherical-surface, 300

Spine [lofted-surface], 278

spiral-curve, 302

split, 99

split-surface, 302

Src [base-form-control], 181

standard-query-row, 86

Standard-saved-slots [layout-mixin], 190

standard-sequence, 86

Standard-views [base-html-graphics-sheet], 182

Start [arc], 106

Start [c-cylinder], 119

Start [constrained-line], 125

Start [curve], 241

Start [cylinder], 127

Start [general-note], 131

Start [line], 143

Start [linear-curve], 276

Start [text-line], 160

Start [typeset-block], 163

Start-angle [arc], 106

Start-angle [arcoid-mixin], 107

Start-angle [circle], 121

Start-angle [constrained-fillet], 125

Start-angle [ellipse], 129

Start-angle [spherical-cap], 159

Start-horizontal-arc [sphere], 157

Start-line-index [typeset-block], 163

Start-point [angular-dimension], 104

Start-point [conic-curve], 237

Start-point [linear-dimension], 145

Start-tangent [conic-curve], 240

Start-vertical-arc [sphere], 157

status-message, 99

step-reader, 304

stitched-solid, 305

Straight-curves [global-filleted-polyline-curves], 271

Straights [global-filleted-polyline-mixin], 135

string-append, 99

Strings [general-note], 132

Strings [label], 142

Strings-for-display [base-rule-object], 85

Strings-for-display [cad-assembly], 229

Strings-for-display [codebase-directory-node], 84

Strings-for-display [package-dokumentation], 323

Strings-for-display [vanilla-mixin*], 87

Style [base-form-control], 181

subtract-vectors, 171

subtracted-solid, 306

Success? [curve], 241

Success? [planar-section-curve], 285

sum-elements, 99

Suppress-display? [base-rule-object], 85

surface, 306

Surface [3d-approximated], 203

Surface [3d-curve], 204

Surface [dropped-curve], 247

Surface [extended-surface], 257

Surface [iso-curve], 273

Surface [joined-surfaces], 274

Surface [planar-section-curve], 285

Surface [planar-section-curves], 287

Surface [projected-curve], 289

Surface [surface-knot-reduction], 310

Surface-1 [general-dual-blend-surface], 266

Surface-2 [general-dual-blend-surface], 266

Surface-in [boxed-surface], 222

Surface-in [offset-surface], 281

Surface-in [redirected-surface], 293

Page 348: Genworks GDL: A User's Manual - Genworks International

342 INDEX

Surface-in [split-surface], 304

Surface-intersection-point [curve], 244

Surface-intersection-points [curve], 244

surface-knot-reduction, 310

Surface-list [compatible-surfaces], 233

Surfaces [iges-reader], 272

Surfaces [native-reader], 280

Surfaces [revolved-surfaces], 296

Surfaces [step-reader], 305

Swap-uv? [redirected-surface], 293

Swapped-uv-surface [surface], 308

swept-solid, 310

Symbols-for-index [master-index], 322

Synchronized? [lofted-surface], 278

Tabindex [base-form-control], 181

Table-class [radio-form-control], 193

Tangent [arc], 106

Tangent [curve], 244

Tangent-method [fitted-surface], 265

Tangent-point [constrained-line], 125

Tangent-points [curve], 244

Target [base-html-sheet], 185

Tessellation [brep], 227

Tessellation-parameters [brep], 224

Tessellation-parameters [surface], 306

Test [menu-form-control], 192

Text [label], 142

Text-above-leader? [linear-dimension], 147

Text-along-axis? [linear-dimension], 147

Text-along-leader-padding-factor [angular-dimension],104

text-form-control, 197

Text-gap [label], 142

text-line, 160

Text-side [label], 142

Text-x-scale [general-note], 132

Text-x-scale [linear-dimension], 147

the, 31, 99

the-child, 99

the-element, 99

the-object, 31, 100

Title [assembly], 321

Title [base-ajax-sheet], 175

Title [base-form-control], 181

Title [package-dokumentation], 323

Title [pie-chart], 151

Title-color [pie-chart], 151

Title-font [pie-chart], 151

Title-font-size [pie-chart], 151

To-location [transformed-solid], 313

To-orientation [transformed-solid], 313

Tolerance [3d-approximated], 204

Tolerance [approximated-curve], 205

Tolerance [compatible-curves], 233

Tolerance [curve], 240

Tolerance [fitted-curve], 263

Tolerance [fitted-surface], 265

Tolerance [joined-surfaces], 275

Tolerance [lofted-surface], 278

Tolerance [non-rational-curve], 280

Tolerance [normalized-curve], 281

Tolerance [offset-solid], 281

Tolerance [planar-offset-curve], 282

Tolerance [shelled-solid], 300

Tolerance [spiral-curve], 302

Tolerance [stitched-solid], 306

Tolerance [surface-knot-reduction], 310

Tolerance [surface], 307

Tolerance-divisor [non-rational-curve], 280

Tolerance-divisor [spiral-curve], 302

Tolerance-factor [3d-approximated], 204

Top-cap? [cylinder], 127

torus, 160

Total-length [curve], 244

transform-and-translate-point, 171

transform-numeric-point, 171

transformed-solid, 310

Transitory-slots [base-html-sheet], 185

translate, 171

translate-along-vector, 171

Translation-threshold [boxed-curve], 220

transpose-matrix, 171

tree, 320

Tree-bgcolor [layout-mixin], 189

Tree-color [tree], 320

Tree-title [layout-mixin], 189

Triangle-data [brep], 226

Trim [curve], 244

trimmed-curve, 313

Page 349: Genworks GDL: A User's Manual - Genworks International

INDEX 343

trimmed-surface, 315

twice, 100

Type [standard-query-row], 86

Type [vanilla-mixin*], 89

Type-mapping [codebase-directory-node], 84

typeset-block, 162

U-degree [b-spline-surface], 210

U-degree [boxed-surface], 223

U-degree [fitted-surface], 265

U-degree [general-dual-blend-surface], 268

U-degree [offset-surface], 282

U-degree [redirected-surface], 293

U-iso-curves [face], 260

U-iso-curves [surface], 308

U-knot-vector [b-spline-surface], 212

U-knot-vector [boxed-surface], 223

U-knot-vector [general-dual-blend-surface], 268

U-knot-vector [redirected-surface], 294

U-max [curve], 241

U-max [normalized-curve], 281

U-max [surface], 309

U-min [curve], 241

U-min [normalized-curve], 281

U-min [surface], 309

U-or-v [iso-curve], 273

U-or-v [split-surface], 304

U-start [fitted-surface], 265

U1 [curve], 242

U1 [trimmed-curve], 315

U2 [curve], 242

U2 [trimmed-curve], 315

Ui-display-list-leaves [layout-mixin], 189

Ui-display-list-leaves [node-mixin], 193

Ui-display-list-objects [layout-mixin], 189

Ui-display-list-objects [node-mixin], 193

Ui-specific-layout-js [base-ajax-sheet], 177

undefine-object, 100

Underline? [general-note], 132

Underline? [linear-dimension], 147

united-solid, 317

unitize-vector, 171

universal-time-from-iso-8601, 100

Update

[vanilla-mixin*], 90

Url [base-html-sheet], 185

Use-ascssk? [lofted-surface], 278

Use-bsplines? [base-html-graphics-sheet], 182

Use-jquery? [base-ajax-sheet], 177

Use-jquery? [master-index], 322

Use-raphael-graf? [base-ajax-graphics-sheet], 173

Use-raphael? [base-ajax-graphics-sheet], 173

Use-recovery-object? [session-control-mixin], 194

Use-standard-saved-slots? [layout-mixin], 190

Usemap [base-form-control], 181

Uv-curve [3d-approximated], 204

Uv-curve [3d-curve], 204

Uv-curve [curve], 240

Uv-curve [dropped-curve], 249

Uv-curve [edge], 251

Uv-curve [iso-curve], 273

Uv-curve [planar-section-curve], 285

Uv-curve [projected-curve], 291

Uv-curves [planar-section-curves], 287

Uv-inputs [trimmed-surface], 317

uv-iso-curve, 318

V-degree [b-spline-surface], 212

V-degree [boxed-surface], 223

V-degree [fitted-surface], 266

V-degree [general-dual-blend-surface], 268

V-degree [lofted-surface], 278

V-degree [offset-surface], 282

V-degree [redirected-surface], 294

V-iso-curves [face], 260

V-iso-curves [surface], 308

V-knot-vector [b-spline-surface], 212

V-knot-vector [boxed-surface], 223

V-knot-vector [redirected-surface], 294

V-max [surface], 309

V-min [surface], 309

V-start [fitted-surface], 266

Validation-function [base-form-control], 181

Value [base-form-control], 182

vanilla-mixin*, 87

Variable-docs [package-dokumentation], 323

variable-sequence, 90

Vector [swept-solid], 310

Vector-graphics [base-ajax-graphics-sheet], 174

Vector-type [fitted-curve], 263

Page 350: Genworks GDL: A User's Manual - Genworks International

344 INDEX

Vectors [fitted-curve], 263

Vertex [base-object], 112

Vertex-list [global-filleted-polyline-mixin], 135

Vertex-list [global-polygon-projection], 136

Vertex-list [global-polyline-mixin], 137

Vertex-list [route-pipe], 153

vertical-dimension, 163

Vertices [brep], 226

View [base-html-graphics-sheet], 183

View-center [base-view], 115

View-controls [base-ajax-graphics-sheet], 174

View-direction-default [base-ajax-graphics-sheet],173

View-object [base-ajax-graphics-sheet], 174

View-object [geometry-view-mixin], 187

View-object [layout-mixin], 191

View-point [base-view], 115

View-reference-object [label], 142

View-reference-object [linear-dimension], 147

View-scale [base-view], 115

View-vectors [renderer-mixin], 153

Viewpoints [renderer-mixin], 153

Viewport-border-default [base-ajax-graphics-sheet],173

Violated-rules [layout-mixin], 190

Violated-rules-bgcolor [layout-mixin], 190

Violated-rules-title [layout-mixin], 190

Violated? [base-rule-object], 85

Visible-children [vanilla-mixin*], 87

Volume [box], 117

Volume [brep], 228

Volume [face], 261

Volume-moments-of-inertia [brep], 228

Volume-moments-of-inertia [face], 261

Volume-products-of-inertia [brep], 228

Volume-products-of-inertia [face], 261

Volume-second-moment-about-coordinate-axii [brep],228

Volume-second-moment-about-coordinate-axii [face],261

Volume-static-moments [brep], 228

Volume-static-moments [face], 261

web-drawing, 198

Web3d-graphics [base-ajax-graphics-sheet], 174

Weights [3d-curve], 205

Weights [b-spline-curve], 210

Weights [b-spline-surface], 212

Weights [boxed-curve], 220

Weights [boxed-surface], 223

Weights [redirected-surface], 294

Which-end [extended-surface], 259

Width [arc], 106

Width [base-drawing], 109

Width [base-object], 111

Width [boxed-curve], 220

Width [boxed-surface], 223

Width [center-line], 121

Width [cone], 123

Width [cylinder], 127

Width [ellipse], 129

Width [general-note], 132

Width [geometry-view-mixin], 187

Width [layout-mixin], 190

Width [rectangular-surface], 291

Width [route-pipe], 155

Width [sphere], 158

Width [spherical-cap], 159

Width [surface], 307

Width [text-line], 160

Width [torus], 162

with-cl-who, 202

with-cl-who-string, 202

with-error-handling, 100

with-format, 100

with-format-slots, 100

with-html-form, 202

with-pinned-values, 318

Witness-1-to-center? [angular-dimension], 104

Witness-2-to-center? [angular-dimension], 105

Witness-direction-vector [horizontal-dimension],139

Witness-direction-vector [linear-dimension], 145

Witness-direction-vector [parallel-dimension], 148

Witness-direction-vector [vertical-dimension], 164

Witness-line-2? [linear-dimension], 147

Witness-line-ext [linear-dimension], 147

Witness-line-gap [linear-dimension], 147

Witness-line-length [linear-dimension], 148

Witness-line? [linear-dimension], 148

Page 351: Genworks GDL: A User's Manual - Genworks International

INDEX 345

Write-child-links [base-html-sheet], 186Write-development-links [base-html-sheet], 186Write-embedded-vrml-world [base-html-graphics-

sheet], 183Write-embedded-x3d-world [base-html-graphics-

sheet], 183Write-embedded-x3dom-world [base-ajax-graphics-

sheet], 174write-env, 101Write-geometry [base-html-graphics-sheet], 184Write-html-sheet [base-html-sheet], 186Write-html-sheet [color-map], 187Write-html-sheet [layout-mixin], 191Write-html-sheet [package-dokumentation], 323Write-html-sheet [package-form], 324write-plist, 101Write-saved-slots [layout-mixin], 191Write-self-link [base-html-sheet], 186Write-snapshot [vanilla-mixin*], 90Write-standard-footer [base-html-sheet], 186write-the, 101write-the-object, 101

X3dom-graphics [base-ajax-graphics-sheet], 174

zero-vector?, 171Zoom-factor [base-html-graphics-sheet], 183Zoom-mode [base-html-graphics-sheet], 183