I just can't figure this one out. Small little routine to calculate the total run of a PLINE (not complete, just starting it out) but from the dialog box, I want "CONTINUE" and "END" buttons. Continue will prompt user to select another 2 points to add. Original dialog box won't close to allow user input. What the heck am I not doing correct?
DCL:
TD : dialog {label = "Total Distance"; :edit_box {label = "Total distance: "; key = "DISTANCE";} :boxed_column {label = "Continue to add? "; :row { :button {label = "Continue"; key = "CONTINUE"; allow_accept = true;} :button {label = "End"; is_cancel = true;} } } }
LSP:
(defun C:TD () (setvar "CMDECHO" 0) (setq C-LAYER (getvar "CLAYER")) (defun PLINE-GEN () (setvar "ORTHOMODE" 1) (setq PT1 (getpoint "\nSelect first point: ")) (setq PT2 (getpoint PT1 "\nSelect second point: ")) (command "PLINE" PT1 PT2 "") ) (defun ADD-LINE () (unload_dialog dcl_id) (done_dialog) (term_dialog) (alert "Here we go again...") (setq PT3 (getpoint PT2 "\nSelect second point: ")) (command "PLINE" PT2 PT3 "") (DIA) ) (defun DIA () (setq dcl_id (load_dialog "TD")) (if (not (new_dialog "TD" dcl_id))(EXIT)) (progn (action_tile "CONTINUE" "(done_dialog)(ADD-LINE)") (if (= DIST-NUM nil)(set_tile "DISTANCE" "0")(set_tile "DISTANCE" DIST-NUM)) (mode_tile "accept" 2) (start_dialog) (unload_dialog dcl_id) ) ) (PLINE-GEN) (DIA) (setvar "CMDECHO" 1) (PRINC) )
Any help is GREATLY appreciated...
@tcarbone wrote:I just can't figure this one out. Small little routine to calculate the total run of a PLINE (not complete, just starting it out) but from the dialog box, I want "CONTINUE" and "END" buttons. Continue will prompt user to select another 2 points to add. Original dialog box won't close to allow user input. What the heck am I not doing correct?
Any help is GREATLY appreciated...
Not sure why you used edit box for "DISTANCE" if the purpose is only to show the Total length, but i guess you know what you're doing.
(defun C:TD ( / Dist-num GoTo) (setvar "CMDECHO" 0) (setq C-LAYER (getvar "CLAYER")) (defun PLINE-GEN () (setvar "ORTHOMODE" 1) (setq PT1 (getpoint "\nSelect first point: ")) (setq PT2 (getpoint PT1 "\nSelect second point: ")) (command "PLINE" PT1 PT2 "") ) (defun ADD-LINE () (setq PT3 (getpoint PT2 "\nSelect second point: ")) (command "PLINE" PT2 PT3 "") (setq DIST-NUM (+ DIST-NUM (distance pt2 pt3))) (setq pt2 pt3 GoTo nil) (DIA) ) (defun DIA () (setq dcl_id (load_dialog "TD")) (if (not (new_dialog "TD" dcl_id))(EXIT)) (progn (if (= DIST-NUM nil) (set_tile "DISTANCE" "0") (set_tile "DISTANCE" (rtos DIST-NUM 2 2)) ) (mode_tile "accept" 2) (action_tile "CONTINUE" "(setq Goto T)(done_dialog 1)") (action_tile "End" "(done_dialog 0)") (start_dialog) (unload_dialog dcl_id) ) (if GoTo (ADD-LINE)) ) (PLINE-GEN) (setq DIST-NUM (distance pt1 pt2)) (DIA) (setvar "CMDECHO" 1) (PRINC) )
HTH
Welcome to the forum tcarbone.
The use of system variable osmode must be used side by side with the command call that
askes for getting points .