home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
misc_lsp.zip
/
BLEND.LSP
< prev
next >
Wrap
Text File
|
1986-02-06
|
4KB
|
162 lines
;============================ P-SURF.LSP ================================
;
; Patch surface routine for use with AutoCAD Version 2.6
;
; Written by John Lynch November, 1986
;
; Modified by Ian Kitching to patch multiple lines May 20, 1987
;
;
(defun C:BLEND ()
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(setq add 0)
(prompt "Select lines to surface\n")
(setq sset (ssget))
(setq nrow (getint "\nEnter number of faces ALONG lines: "))
(setq ncol (getint "\nEnter number of faces BETWEEN lines: "))
(setq x 0) (setq fl 1) (setq mult nil)
(setq test "3DLINE")
(setq count 0) (setq ct 0)
(while (/= count nil)
(setq count (ssname sset ct))
(setq ct (1+ ct))
)
(setq ct (1- ct))
(princ ct) (princ " entities found\n")
(while (/= ct x)
(setq isit nil)
(if (/= mult nil) (progn
(while (/= test isit)
(setq fl lsl)
(setq sl (entget (ssname sset x)))
(setq x (1+ x))
(setq isit (cdr (assoc 0 sl)))
)
(setq isit nil)
)
)
(if (= x 0) (progn
(while (/= test isit)
(setq fl (entget (ssname sset x)))
(setq x (1+ x))
(setq isit (cdr (assoc 0 fl)))
)
(setq isit nil)
(while (/= test isit)
(setq sl (entget (ssname sset x)))
(setq x (1+ x))
(setq mult 1)
(setq isit (cdr (assoc 0 sl)))
)
)
)
(setq lfl fl) (setq lsl sl)
(ptli)
)
(setvar "cmdecho" 1)
(setvar "blipmode" 1)
)
;
;Initilize the beginning points and determine the vecors along the lines.
;
(defun ptli ()
(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)
)
)
)
;---------------------- VECTOR() -----------------------------
; Function to determine a vector between two point 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)
)