![]() |
4.207
Formal Design Knowledge and 4.207 Programmed Constructs |
Assignment Description Illustrations/Explanations A1
simple batch file that:
-sets the drawing environment
-models a rectangular slab
-models 7 beams
-visualizes them in axonometric shaded viewA2a
same batch file +
-assigned variables
-arithmeticsA2b
same batch file +
-simple function
A2c
same batch file +
-function with local variables
A2d
same batch file +
-conditional loop
A2e
program with 3 functions:
-1.sets up the drawing environment to prepare the file to the creation of beams (limits,layers)
-2.models parametric beams
-3.demo that shows 4 different applications (doesn't take any parameter) parameters passed by the user:-1.(defun prepbeam (limitsx limitsy gridspacing)
-2.(defun modelbeam (x y beamw beaml beamh)
example of use in AutoCAD:
to load program
command:(load "a2e")to call function and pass in parameters
command:(modelbeam 10 20 12 240 15)to show demo
command: demoA#3a
ceilingprogram that performs the same routine as the previous, but now interacting with the user
it asks the following data:-first point
-second point
-direction of beams in case slab is square
-round up or down the number of beamsit also tests the input given by the user and displays error messages
the program was split in 3 modules: main function ceiling and sub-functions model_slab and model_beams
A#3b
model_slabthis module of the program models the slab, taking as parameters:
- the slab x and y dimensions
- the slab heightA#3c
model_beamsthis module of the program models the beams, taking as parameters
-the slab x and y dimensions
-the beam width
-beam heigth
-ideal spacingit also calculates:
-number of beams
-adjusted spacingthe function FIX was used to round up and down the decimal number of beams calculated to an integer number:
(setq in_round_down (fix in))
(setq in_round_up (+ 1 (fix in)))the program then performs calculations to find if the adjusted spacing is closer to the ideal spacing if the number is rounded down or up, and it shows the user the two different possibilities, offering the closer spacing as the default value:
"Would you like "(rtos in_round_down 2 0)" beams with a "(rtos as1 2 2)"\" spacing or "(rtos in_round_up 2 0)" beams" " with a "(rtos as2 2 2)"\" spacing?<"(rtos n_default 2 0)">"
note that the function rtos was used to coerce real numbers into strings to be printed at the prompt line.
A#3d
ceiling2this program does the same, but asks the user to select two point entities, rather than to pick two points.
it then checks to see if the selected objects were legal entities, displaying an error message if not.after the selected entity is stored into the variable p1, the functions car, entget, assoc and cdr are used to extract the entity type information from different kinds of nested lists. that information is then compared to the string "POINT":
(setq p1 (entsel "Pick one \"point\" entity at the top of the slab:"))
(setq entity1 (car p1))
(setq p1list (entget entity1))
(setq 0p1type (assoc '0 p1list))
(setq p1type (cdr 0p1type))
(if (= p1type "POINT")
(setq legalpoint1 t)A#4
porticowritten for NITROS environment, this program has both addition and transformations that can be applied to instances literals. departing from a simple rectangle the user can divide it into the three parts of a portico according to the ionic proportions: pediment, entablature and colonade. then, each part can be further developed: the pediment can have an ionic proportion cornice added, the entablature can be divided into cornice, frize and architrave, and the collonade can have columns added, with intercolumniations of 2.25 times de diameter and whatever left over from the division in the central space. all the calculations were based on Palladio's 4 books of architecture.
all the transformations are parametric, allowing to trace back all the steps and make changes in the variables set at the insertion of the portico rectangle.
from beginning to end
parametric shapes
click on each node of the diagram to see the mathematical
formulas and relationships between each part
all the resultant literals have their dimensions calculated directly from the parameters H and W from the original literal from which they derive. for that reason, by changing parameters in the results of the first or second generations it is possible to alter all their siblings automatically.
in the figure f(W) means function of the original literal width, f(H) means function of the original literal heigth, and f(W&H) means function of both.
in this program part of the geometry is created not by AutoLISP code, but rather by insertion of dwg blocks, which are scaled in the x and y axes ate the moment of the insertion, like in the sample besides. square.dwg is a 1x1 units square that can be turned into any proportin rectangle at the moment of the insertion. in this way what is dinamically calculated by the program is the x and y scales, instead of each vertex coordinates.
the pediment and square blocks are created on the spot as the main function a4 is loaded. the column block, an elaborated ionic column 2d drawing, is a dwg external file that needs to be in the target directory so that the AutoLisp program can find it and insert it.
the "elaborated ionic column" definition uses two loops for inserting the columns. the first loop (if) makes sure that the number of columns is not zero. if so, it will skip the insertion process and reinsert a rectangle in the elaborated ionic collonade area. if the parameters of the original portico are changed, the program will insert columns in the colonade, as soon as it becames wide enough for that.
(note that code on the right is not complete)
geometry function for the Portico
(defun portico (xo yo zo w h / portico1)
(command "-insert" "square" (list xo yo zo) w h 0)
(setq portico1 (entlast)) portico1
)
geometry function for the Elaborated Ionic Collonade(if (>= n_columns 2)
(while (<= col_index (- half_n_columns 1))
(command "-insert" "column" (list x1 yo zo) d d 0)
(command "mirror" "l" "" (list xo yo) (list xo (+ 1 yo)) "n")
(setq col_index (+ col_index 1))
)[else]
(setq yscale (* 9 d))
(command "-insert" "square" (list xo yo zo) w yscale 0)