Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DCL not closing

4 REPLIES 4
Reply
Message 1 of 5
tcarbone
402 Views, 4 Replies

DCL not closing

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...

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: tcarbone


@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.

 

 

Message 3 of 5
_Tharwat
in reply to: pbejse

The use of system variable osmode must be used side by side with the command call that

askes for getting points .Smiley Wink

Message 4 of 5
tcarbone
in reply to: pbejse

Perfect... thanks so much!!!

Message 5 of 5
pbejse
in reply to: tcarbone


@tcarbone wrote:

Perfect... thanks so much!!!


You are welcome tcarbone. And welcome to the forum Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost