2009-12-14 11:18 UTC
Question:
I want to pick a point in AutoCAD while a modal form is showing.
Answer:
You cannot pick a point or select objects in the drawing as long a modal form is showing. You have to close the form and to show it again after you have picked the point. The returning values for dcl_form_show and dcl_form_close will help you.
(defun c:MyProg (/ doCont intResult c:proj_form_OnInitialize c:proj_form_pb_accept c:proj_form_pb_select c:proj_form_pb_cancel)
(defun c:proj_form_OnInitialize ()
(princ "Initializing the form...")
); c:proj_form_OnInitialize
(defun c:proj_form_pb_accept ()
(dcl_form_close proj_form 0)
); c:proj_form_pb_accept
(defun c:proj_form_pb_select ()
(dcl_form_close proj_form 1)
); c:proj_form_pb_select
(defun c:proj_form_pb_cancel ()
(dcl_form_close proj_form 2)
); c:proj_form_pb_cancel
(setq doCont T)
(while doCont
(setq doCont nil) ;; to avoid neverending loop at ESC
(setq intResult (dcl_form_show proj_form))
(cond
((= intResult 0) (princ "Something will happen here."))
((= intResult 1) (setq ptPoint (getpoint "\nPick point: ")) (setq doCont T)) ;; don't forget to set doCont to T to show the form again
((= intResult 2) (princ "This will be executed after ESC and after pressing Cancel button."))
); cond
); while
(princ)
); MyProg
Here you will find a sample with placing blocks:
{2}
Here you will find a sample with a nested dialog.
{2}
Also see the "Selections.lsp" sample installed with the Studio under: "C:\Program Files\OpenDCL Studio\\Samples"
Fred
I want to pick a point in AutoCAD while a modal form is showing.
Answer:
You cannot pick a point or select objects in the drawing as long a modal form is showing. You have to close the form and to show it again after you have picked the point. The returning values for dcl_form_show and dcl_form_close will help you.
(defun c:MyProg (/ doCont intResult c:proj_form_OnInitialize c:proj_form_pb_accept c:proj_form_pb_select c:proj_form_pb_cancel)
(defun c:proj_form_OnInitialize ()
(princ "Initializing the form...")
); c:proj_form_OnInitialize
(defun c:proj_form_pb_accept ()
(dcl_form_close proj_form 0)
); c:proj_form_pb_accept
(defun c:proj_form_pb_select ()
(dcl_form_close proj_form 1)
); c:proj_form_pb_select
(defun c:proj_form_pb_cancel ()
(dcl_form_close proj_form 2)
); c:proj_form_pb_cancel
(setq doCont T)
(while doCont
(setq doCont nil) ;; to avoid neverending loop at ESC
(setq intResult (dcl_form_show proj_form))
(cond
((= intResult 0) (princ "Something will happen here."))
((= intResult 1) (setq ptPoint (getpoint "\nPick point: ")) (setq doCont T)) ;; don't forget to set doCont to T to show the form again
((= intResult 2) (princ "This will be executed after ESC and after pressing Cancel button."))
); cond
); while
(princ)
); MyProg
Here you will find a sample with placing blocks:
{2}
Here you will find a sample with a nested dialog.
{2}
Also see the "Selections.lsp" sample installed with the Studio under: "C:\Program Files\OpenDCL Studio\\Samples"
Fred