;; sorry, fixing an error
(IF (NOT (FINDFILE "ef_001_2008.dcl"))
(PROGN
(SETQ _acad (FINDFILE "acad.exe")
_acad (STRCAT (SUBSTR _acad 1 (- (STRLEN _acad)
)
"ef_001_2008.dcl"
)
_acad (OPEN _acad "w")
)
(FOREACH x
'("ef_001_2008:dialog{label=\"Rectangles\";key=\"rec\";initial_focus=\"x\";"
"width=60;fixed_width=true;"
":column{alignment=centered;fixed_width=true;:spacer{height=1;}"
":row{alignment=centered;fixed_width=true;fixed_height=true;"
":column{alignment=centered;:text{label=\"Insertion point\";}"
":row{alignment=centered;fixed_width=true;fixed_height=true;:radio_column{key=\"r1\";"
":radio_button{label=\"&Above\";key=\"above\";}"
":radio_button{label=\"&Below\";key=\"below\";}}"
":spacer{width=3;}:radio_column{key=\"r2\";"
":radio_button{label=\"&Left\";key=\"left\";}"
":radio_button{label=\"&Right\";key=\"right\";}}}}"
":spacer{width=3;}"
":column{alignment=top;fixed_width=true;fixed_height=true;"
":edit_box{label=\"Dim &X\";key=\"x\";edit_width=12;width=22;fixed_width=true;}"
":edit_box{label=\"Dim &Y\";key=\"y\";edit_width=12;width=22;fixed_width=true;}}}"
":spacer{height=1;}"
":toggle{label=\"&Diagonals\";key=\"diagonals\";}:spacer{height=1;}"
":row{fixed_width=true;height=3;fixed_height=true;alignment=centered;"
":button{label=\"Abo&ut\";is_cancel=true;key=\"help\";width=16;height=2;"
"fixed_width=true;fixed_height=true;}"
":button{label=\"&Cancel\";is_cancel=true;key=\"cancel\";width=16;height=2;"
"fixed_width=true;fixed_height=true;}"
":button{label=\"&Proceed\";is_default=true;key=\"accept\";width=16;height=2;"
"fixed_width=true;fixed_height=true;}}}}"
)
(PRINC x _acad)
)
(CLOSE _acad)
(SETQ _acad nil)
)
(PRINC)
)
(DEFUN c:rec1 (/ dx dy dh w@ about exec verif)
(DEFUN exec (/ p1 p2 p3 p4)
(IF (SETQ p1 (GETPOINT "\n-> Insertion point : "))
(PROGN (SETQ dx (ATOF dx)
dy (ATOF dy)
p2 (POLAR p1 0.0 dx)
p3 (POLAR p2 (* PI 0.5) dy)
p4 (POLAR p1 (* PI 0.5) dy)
lista (LIST p1 p2 p3 p4)
)
(IF (= g::ef::01_2008_high "above")
(SETQ
lista (MAPCAR '(LAMBDA (x)
(LIST (CAR x) (- (CADR x) dy) (CADDR x))
)
lista
)
)
)
(IF (= g::ef::01_2008_dire "right")
(SETQ
lista (MAPCAR '(LAMBDA (x)
(LIST (- (CAR x) dx) (CADR x) (CADDR x))
)
lista
)
)
)
(ENTMAKE (LIST '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
'(90 . 4)
'(70 . 1)
'(43 . 0.0)
'(38 . 0.0)
'(39 . 0.0)
(CONS 10 (NTH 0 lista))
'(40 . 0.0)
'(41 . 0.0)
'(42 . 0.0)
(CONS 10 (NTH 1 lista))
'(40 . 0.0)
'(41 . 0.0)
'(42 . 0.0)
(CONS 10 (NTH 2 lista))
'(40 . 0.0)
'(41 . 0.0)
'(42 . 0.0)
(CONS 10 (NTH 3 lista))
'(40 . 0.0)
'(41 . 0.0)
'(42 . 0.0)
)
)
(IF (= g::ef::01_2008_diag "1")
(PROGN (ENTMAKE (LIST (CONS 0 "LINE")
(CONS 10 (NTH 0 lista))
(CONS 11 (NTH 2 lista))
)
)
(ENTMAKE (LIST (CONS 0 "LINE")
(CONS 10 (NTH 1 lista))
(CONS 11 (NTH 3 lista))
)
)
)
nil
)
;;
)
(PRINC "\n-> No insertion point...")
)
)
(DEFUN about ()
(ALERT (STRCAT "\n\tThis routine was wrote by E.Fernal\t\t\n\t"
"
http://www.gr-acad.com.br\n\n"
)
)
)
(DEFUN verif ()
(IF (AND (SETQ dx (GET_TILE "x"))
(NUMBERP (READ dx))
(NOT (ZEROP (ATOF dx)))
(SETQ dy (GET_TILE "y"))
(NUMBERP (READ dy))
(NOT (ZEROP (ATOF dy)))
)
(DONE_DIALOG 1)
(ALERT "\n\tPlease, verify numeric values for X and Y...\t\n")
)
)
(IF (> (SETQ dh (LOAD_DIALOG "ef_001_2008.dcl")) 0)
(IF (NEW_DIALOG "ef_001_2008" dh "" '(5 5))
(PROGN
(IF (NOT g::ef::01_2008_high)
(SETQ g::ef::01_2008_high "below")
)
(SET_TILE g::ef::01_2008_high "1")
;;
(IF (NOT g::ef::01_2008_dire)
(SETQ g::ef::01_2008_dire "left")
)
(SET_TILE g::ef::01_2008_dire "1")
;;
(IF (NOT g::ef::01_2008_diag)
(SETQ g::ef::01_2008_diag "1")
)
(SET_TILE "diagonals" g::ef::01_2008_diag)
;;
(FOREACH x '("above" "below")
(ACTION_TILE x "(SETQ g::ef::01_2008_high $key)")
)
(FOREACH x '("left" "right")
(ACTION_TILE x "(SETQ g::ef::01_2008_dire $key)")
)
(ACTION_TILE "diagonals" "(SETQ g::ef::01_2008_diag $value)")
(ACTION_TILE "help" "(about)")
(ACTION_TILE "cancel" "(DONE_DIALOG 0)")
(ACTION_TILE "accept" "(verif)")
(SETQ w@ (START_DIALOG))
(UNLOAD_DIALOG dh)
(COND ((= w@ 0) (PRINC "\n-> Cancelled..."))
(T (exec))
)
)
nil
)
(ALERT "Error:\n\n\tDialog file could not be loaded...\t\n\n")
)
(PRINC)
)
(PRINC "\n-> Type REC1 and press enter to run...")
(PRINC)