home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
autocad
/
aug91.arj
/
TIP682.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1991-09-26
|
2KB
|
71 lines
;TIP682.LSP More BOM Bubble (c)1991, Vitold Serafin
(defun C:BALLOON (/ R L C N X1 Y1 X3 Y3 M
B A BE CE DEL X21 X22 Y21 Y22 Y2 X2 SS
A1 A2 A3 CIRAD TXTHT ATTHT)
(setvar "CMDECHO" 0)
(setvar "ATTDIA" 0)
;hard-wired variables
(setq CIRAD 0.2 ;circle radius
TXTHT 0.18 ;text height
ATTHT 0.125 ;attribute height
)
(setvar "DIMASZ" TXTHT)
;program variables
(setq L (getpoint "\nLeader start: ")
C (getpoint "\nBalloon center: ")
N (getint "\nItem number: ")
X1 (car C)
Y1 (cadr C)
X3 (car L)
Y3 (cadr L)
)
(if (= X1 X3)
(setq X3 (+ 0.001 X3));no divide by 0
)
(setq M (/ (- Y1 Y3) (- X1 X3))
B (- Y1 (* X1 (/ (- Y1 Y3)
(- X1 X3))))
A (+ 1 (* M M))
BE (* 2 (-(* M(- B Y1)) X1))
CE (+(-(* X1 X1)(* CIRAD CIRAD))
(* (- B Y1)(- B Y1)))
DEL (sqrt(- (* BE BE)(* A CE 4)))
X21 (/ (+ (- 0 BE) DEL)(* 2 A))
X22 (/ (- (- 0 BE) DEL)(* 2 A))
Y21 (+ (* M X21) B)
Y22 (+ (* M X22) B))
(if (< (distance L (list X21 Y21))
(distance L (list X22 Y22)))
(setq X2 X21)
(setq X2 X22)
)
(setq Y2 (+ (* M X2) B))
(command "LAYER" "M" "DIM" ^C)
(command "DIM" "LEADER" L (list X2 Y2)
^C ^C)
(setq SS (ssadd)) (ssadd (entlast) SS)
(command "LAYER" "M" "C" ^C)
(command "TEXT" "M" C TXTHT 0 N)
(ssadd (ssname (ssget L) 0) SS)
(ssadd (entlast) SS)
(command "LAYER" "M" "W" ^C)
(command "CIRCLE" C CIRAD)
(ssadd (entlast) SS)
(setq A1 (list (- X1 0.042)(+ Y1 0.25))
A2 (list (+ X1 0.167)(+ Y1 0.25))
A3 (list (- X1 0.042)(+ Y1 1.31))
)
(command "ATTDEF" "" "PN" "PART NUMBER"
"" A1 ATTHT 90)
(ssadd (entlast) SS)
(command "ATTDEF" "" "DS" "DESCRIPTION"
"" A2 "" "")
(ssadd (entlast) SS)
(command "ATTDEF" "" "QT" "QTY." "1" A3
"" "")
(ssadd (entlast) SS)
(command "BLOCK" (itoa N) C SS "")
(command "INSERT" (itoa N) C "" "" "")
)