|
Tools
ACAD - AutoLisp
The prototypes were designed in AutoCAD 2002 with help of AutoLisp scripts.
3D modelling
The result from modelling Prototyp #1:
AutoCAD file
To download an example, right click and save this AutoCAD
file
AutoLisp
An example of how to calculate the simple parabolic shape of Prototype
#1 can be seen below:
; *********************************************************************
; ** **
; ** A one hour AutoLisp hack generating parabolic curves **
; ** **
; ** Written: Niklas Forslund **
; ** Date : 2002-09-05 **
; *********************************************************************
;
; Usage:
; 1. Load this file into AutoCad by selecting
; Tools/AutoLISP/Load...
; 2. Enter (parabol) on the command line
; 3. Select the vertex point of the curve
; 4. Select one of the endpoints
; Thats it...
(defun parabol ()
; Ask the user to enter vertex and one of the endpoints
(setq pt1 (getpoint "\nEnter the vertex point of the curve: ")
pt2 (getpoint pt1 "\nEnter one of the end points of the curve: "))
; Calculate some stuff, f(x) = a * (loops * delta)^2 + y
(setq loops 10)
(setq x (car pt1))
(setq y (cadr pt1))
(setq delta (/ (- (car pt2) (car pt1)) loops)) ; X step per loop
(setq a (/ (- (cadr pt2) (cadr pt1)) (* (* delta loops) (* delta loops))))
; Draw the positive part of the parabolic curve
(command "spline")
(while (> loops -1)
(setq lst (list (+ x (* delta loops))
(+ y (* a (* (* delta loops) (* delta loops))))
0
)
)
(command "_NON" lst)
(princ lst)
(setq loops (- loops 1))
)
(command "" "" "")
; End of positive curve drawing
(setq loops 10)
; Draw the negative part of the parabolic curve
(command "spline")
(while (> loops -1)
(setq lst (list (- x (* delta loops))
(+ y (* a (* (* delta loops) (* delta loops))))
0
)
)
(command "_NON" lst)
(princ lst)
(setq loops (- loops 1))
)
(command "" "" "")
; End of negative curve drawing
(princ)
)
(princ)
|