Visual LISP, AutoLISP and General Customization

Reply
New Member
tcarbone
Posts: 2
Registered: ‎11-04-2010
Message 1 of 5 (164 Views)

DCL not closing

164 Views, 4 Replies
05-09-2013 02:30 PM

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

*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 2 of 5 (145 Views)

Re: DCL not closing

05-09-2013 09:38 PM 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.

 

 

Distinguished Mentor
_Tharwat
Posts: 557
Registered: ‎07-02-2010
Message 3 of 5 (137 Views)

Re: DCL not closing

05-10-2013 02:11 AM 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 .:smileywink:

____________________________________________________
Get learn and learn and practice , to become experienced guy .
New Member
tcarbone
Posts: 2
Registered: ‎11-04-2010
Message 4 of 5 (122 Views)

Re: DCL not closing

05-10-2013 05:42 AM in reply to: pbejse

Perfect... thanks so much!!!

*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 5 of 5 (100 Views)

Re: DCL not closing

05-10-2013 09:00 PM in reply to: tcarbone

tcarbone wrote:

Perfect... thanks so much!!!


You are welcome tcarbone. And welcome to the forum :smileyhappy:

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community