AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Copy this into Notepad and save it as "Flag.lsp".
Enjoy!!!

;CODING STARTS HERE

;Written by Watson Kilbourne
(prompt "\nType FLAG to run and stand to attention........")
(defun C:FLAG ( / SP HT XD XA EP YA D1 D2
D3 D4 RP RH XZ YZ P1 P2
P3 P4 P5 P6 P7 P8 P9 PX
PY PZ S1 S2 S3 S4 S5 S6
oldecho)

(setq oldecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)

(while (= SP nil)
(setq SP (getpoint "\nPick Lower Left Corner of Flag : "))
);while

(while (= HT nil)
(setq HT (getcorner SP "\nPick Upper Right Corner of Flag : "))
);while

(if (>= (angle SP HT) (/ pi 2))
(setq HT (polar SP (/ pi 4)
(distance SP HT)))
);if

(setq XD (distance SP HT)
XA (angle SP HT)
EP (polar SP (/ pi 2) (* XD (sin XA)))
YA (angle SP EP)
D1 (distance SP EP)
D2 (/ D1 13)
D3 (* D2 0.8)
D4 (* D2 1.4)
RP (polar SP 0.0 (* D1 1.5))
RH (polar EP 0.0 (* D1 1.5))
XZ (polar SP (* pi 1.25) D2)
YZ (polar RH (* pi 0.25) D2)
P1 (polar SP (/ pi 2) (* d2 6))
P2 (polar P1 0.0 (* D2 8.5))
P3 (polar EP 0.0 (* D2 8.5))
P4 (polar SP YA D2)
P5 (polar RP YA D2)
P6 (polar P4 YA D2)
P7 (polar P5 YA D2)
P8 (polar RP YA (* D2 6))
P9 (polar P2 YA D2)
PX (polar P8 YA D2)
PY (polar P9 YA D2)
PZ (polar PX YA D2)
S1 (polar P1 (* pi 0.25) D2)
S2 (polar S1 (* pi 0.3) (* D3 0.172))
S3 (polar S1 (* pi 0.7) (* D3 0.172))
S4 (polar S1 YA (* D3 0.43952))
S5 (polar S1 (* pi 0.25) D2)
S6 (polar P3 (* pi 1.25) D4)
);setq

(command "BLIPMODE" "OFF"
"FILL" "ON"
"ZOOM" "W" XZ YZ
"LAYER" "M" "BLUE" "C" "5" "" ""
"SOLID" P1 P2 EP P3 ""
"LAYER" "M" "RED" "C" "1" "" ""
"SOLID" SP P4 RP P5 ""
"ARRAY" "L" "" "R" "3" "1" (* D2 2)
"SOLID" P2 P9 P8 PX ""
"ARRAY" "L" "" "R" "4" "1" (* D2 2)
"LAYER" "M" "WHITE" "C" "7" "" ""
"SOLID" P4 P6 P5 P7 ""
"ARRAY" "L" "" "R" "3" "1" (* D2 2)
"SOLID" P9 PY PX PZ ""
"ARRAY" "L" "" "R" "3" "1" (* D2 2)
"SOLID" S1 S2 S3 S4 ""
"ARRAY" "L" "" "P" S1 "5" "360" "Y"
"ARRAY" "W" P1 S5 "" "R" "5" "6" D4 D4
"COPY" "W" P1 S6 "" S1 S5
"BLIPMODE" "ON"
);command

(setvar "CMDECHO" oldecho)

(princ)
);defun
(princ)

;CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website