Hi Alls,
I'm attempt to "recreating" code from "Terry Miller",to more simple and easy to understand,here that code,what am I do wrong with this code.
LSP File
(defun *create_icon* (lst / cnt col x x1 x2 y y1 y2)
(if
(= (type lst) 'list)
(progn
(setq cnt 0)
(repeat
(/ (length lst) 2)
(setq x (nth cnt lst))
(setq y (nth (+ cnt 1) lst))
(if
(and (= (type x) 'str)(= (type y) 'int))
(if
(= (strcase x "c"))
(progn
(setq col y)
(setq x1 nil)
(setq y1 nil)
(setq x2 nil)
(setq y2 nil)
) ; progn
) ; if
(if
(and (= (type x) 'int) (= (type y) 'int))
(if
(and (= x1 nil) (= y1 nil))
(progn
(setq x1 x)
(setq y1 y)
) ; progn
(progn
(setq x2 x)
(setq y2 y)
(vector_image x1 y1 x2 y2 col)
(setq x1 x2)
(setq y1 y2)
(setq x nil)
(setq y nil)
) ; progn
) ; if
) ; if
) ; if
) ; repeat
(setq cnt (+ cnt 2))
) ; progn
) ; if
) ; defun
(defun *smile* ( )
(start_image "smile")
(*create_icon* lst1)
(*create_icon* lst2)
(*create_icon* lst3)
(end_image)
) ; defun
(defun c:ci (/ dcl_id ans)
(setq dcl_id (load_dialog "Create Icon.DCL"))
(if
(not (new_dialog "ci" dcl_id))
(exit)
) ; if
(setq lst1 (list "C" 2 2 12 2 19 "C" 2 3 9 3 22 4 23 4 8 "C" 2 5 6 5 25 6
26 6 5 7 5 7 26 8 27 8 4 9 3 9 28 10 28 10 3 11 3 11 28 12 29 12 2 13 2
13 29 14 29 14 2 15 2 15 29 16 29 16 2 17 2 17 29 18 29 18 2 19 2 19 29
20 28 20 3 21 3 21 28 22 28 22 3 23 4 23 27 24 26 24 5 25 5 25 26 26 25
26 6 "C" 2 27 8 27 23 28 22 28 9 "C" 2 29 19 29 12))
(setq lst2 (list "C" 250 12 30 19 30 20 29 22 29 24 27 25 27 27 25 27 24
29 22 29 20 30 19 30 12 29 11 29 9 27 7 27 6 25 4 24 4 22 2 20 2 19 1 12
1 11 2 9 2 7 4 6 4 4 6 4 7 2 9 2 11 1 12 1 19 2 20 2 22 4 24 4 25 6 27 7
27 9 29 11 29 "C" 250 6 18 8 20 9 20 10 21 12 21 13 22 18 22 19 21 21 21
22 20 23 20 25 18 "C" 250 11 12 11 10 12 9 12 13 13 12 13 10 "C" 250 18
12 18 10 19 9 19 13 20 12 20 10))
(setq lst3 (list "C" 8 7 28 8 29 "C" 8 14 32 21 32 "C" 8 10 30 11 30 11
31 24 31 25 30 20 30 "C" 8 27 29 23 29 24 28 28 28 29 27 26 27 27 26 29
26 29 23 28 24 28 25 "C" 8 30 20 30 25 31 24 31 11 30 11 30 10 "C" 8 32
21 32 14 "C" 8 28 7 29 8))
(*smile*)
(setq ans (start_dialog))
(unload_dialog dcl_id)
(princ)
) ; defun
and here DCL File
ci : dialog {label = "SAMPLE CREATE ICON";
spacer;
: row {
: column {
: image {key = "smile";
width = 5.42;
height = 2.51;
fixed_width = true;
fixed_height = true;
aspect_ratio = 1;
color = -15;
alignment = centered;}}}
spacer;
: ok_button{is_cancel = true;}}