home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
misc_lsp.zip
/
P-SURF.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1987-08-26
|
3KB
|
115 lines
;============================ P-SURF.LSP ================================
;
; Patch surface routine for use with AutoCAD Version 2.6 and later
;
; Written by John Lynch November, 1986
;
;---------------------- VECTOR() -----------------------------
; Function to determine a vector between two points and divided by m.
;
(defun vector (ep bp m / x1 x2 y1 y2 z1 z2 dx dy dz)
;
; bp : The beginnning point of the line.
; ep : The end point of the line.
; m : The number of divisions in the line.
;
(setq x1 (car bp)
y1 (cadr bp)
z1 (caddr bp)
)
(setq x2 (car ep)
y2 (cadr ep)
z2 (caddr ep)
)
(setq dx (/ (- x2 x1) m)
dy (/ (- y2 y1) m)
dz (/ (- z2 z1) m)
)
(list dx dy dz)
)
;-----------------------------VECTADD() ------------------------------
; Function to add a vector to a point.
;
(defun vectadd (bp vec / x1 x2 y1 y2 z1 z2 dx dy dz)
;
; bp : Beginning point assumed to be a list of three reals.
; vec : Vector to add to the point assumed to be the same.
;
(setq x1 (car bp)
y1 (cadr bp)
z1 (caddr bp)
)
(setq x2 (car vec)
y2 (cadr vec)
z2 (caddr vec)
)
(setq dx (+ x1 x2)
dy (+ y1 y2)
dz (+ z1 z2)
)
(list dx dy dz)
)
;---------------------------------------------------------------------
; P-SURF command, main program
(defun C:P-SURF ()
(setq fl (entget (car (entsel "\nPoint to first line: "))))
(setq sl (entget (car (entsel "\nPoint to second line: "))))
(initget (+ 1 2 4)) ; Disallow null, zero, negative replies
(setq nrow (getint "\nEnter number of faces ALONG lines: "))
(initget (+ 1 2 4))
(setq ncol (getint "\nEnter number of faces BETWEEN lines: "))
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
; Initialize the beginning points and determine the vectors along the lines.
(setq bp1 (cdr (assoc 10 fl))
ep1 (cdr (assoc 11 fl))
bp2 (cdr (assoc 10 sl))
ep2 (cdr (assoc 11 sl))
vl1 (vector ep1 bp1 nrow)
vl2 (vector ep2 bp2 nrow)
vpl1 (vector bp2 bp1 ncol)
)
(setq m 1)
(while (<= m nrow)
(setq pl1 (vectadd bp1 vl1)
pl2 (vectadd bp2 vl2)
vpl2 (vector pl2 pl1 ncol)
)
; ---- Initialize the face points
(setq lpp1 bp1
lpp2 pl1
n 1
)
(while (<= n ncol)
(setq upp1 (vectadd lpp1 vpl1)
upp2 (vectadd lpp2 vpl2)
)
(command "3dface" lpp1 lpp2 upp2 upp1 "")
(setq lpp1 upp1
lpp2 upp2
n (1+ n)
)
)
(setq bp1 pl1
bp2 pl2
vpl1 vpl2
m (1+ m)
)
)
(setvar "cmdecho" 1)
(setvar "blipmode" 1)
)