Welcome to the Southern African Autolisp Website.
You are Visitor Number
|
| Home. | Page I. |
This routine simply displays a dialogue box that asks the user for a point.
First the DCL Coding:
If the user choosers the pick point button the dialogue is hidden to allow the
user to pick a point on the screen. The dialogue is then re-displayed and the x, y
enter the point values directly into the edit boxes if he so wishes.
hidebox : dialog {
label = "Hide Dialogue";
: boxed_column {
label = "Sample Point";
: button {
label = "Pick Point <";
key = "hide";
width = 12;
fixed_width = true;
mnemonic = "P";
}
: edit_box {
key = "eb1";
label = "&X:";
width = 8;
fixed_width = true;
}
: edit_box {
key = "eb2";
label = "&Y:";
width = 8;
fixed_width = true;
}
: edit_box {
key = "eb3";
label = "&Z:";
width = 8;
fixed_width = true;
}
}
ok_cancel;
}
And now the AutoCAD Coding:
(defun c:hidebox ()
;define the function
(setq ptx "1.000"
pty "0.000"
ptz "0.000"
flag 4
);setq
;set default x,y, and z values
;and set flag to 4
(setq dcl_id (load_dialog "hidebox.dcl"))
;load the DCL file
(while (> flag 2)
;check the flag status and carry on looping
;if it is greater than 2
(if (not (new_dialog "hidebox" dcl_id))
;load the dialogue box
(exit)
;if not loaded exit
)
(set_tile "eb1" ptx)
;display x value
(set_tile "eb2" pty)
;display y value
(set_tile "eb3" ptz)
;display z value
(mode_tile "eb1" 2)
;set focus to x edit box
(mode_tile "eb1" 3)
;select contents
(action_tile
"cancel"
"(done_dialog)
(setq result nil)"
)
;if Cancel button selected, close
;the dialogue. This action sets the
;flag to 0.
(action_tile
"accept"
"(setq ptx (get_tile \"eb1\"))
(setq pty (get_tile \"eb2\"))
(setq ptz (get_tile \"eb3\"))
(done_dialog)
(setq result T)"
)
;if OK button was selected, get the edit box
;point values, close the dialogue. This action
;sets the flag to 1.
(action_tile
"hide"
"(done_dialog 4)"
)
;if pick button selected, hide the dialogue
;and set the flag to 4
(setq flag (start_dialog))
;start the dialogue and set flag
;to value of start dialogue
(if (= flag 4)
;if the pick button was selected
(progn
;do the following
(setq selpoint (getpoint "\nInsertion Point: "))
;get the insertion point
(setq ptx (rtos (car selpoint) 2 4))
;get the x value
(setq pty (rtos (cadr selpoint) 2 4))
;get the y value
(setq ptz (rtos (caddr selpoint) 2 4))
;get the z value
);progn
);if
);while
(unload_dialog dcl_id)
;unload the dialogue
(princ)
);defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(princ);load clean
To hide AND nest dialogue boxes is just a case of combining the two.
(I'll leave that up to you to figure out....)
Would you like the coding for these routines? Then put one leg in the air,
close your left eye, scream as loud as you can and click
here. Enjoy.......
Home.
Page I.
All Tutorials and Code are provided "as-is" for purposes of instruction and
utility and may be used by anyone for any purpose entirely at their own risk.
Please respect the intellectual rights of others.
All material provided here is unsupported and without warranty of any kind.
No responsibility will be taken for any direct or indirect consequences
resulting from or associated with the use of these Tutorials or Code.
Copyright © 1999 by
Kenny Ramage
All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage.