Author Topic: Dommy needs help with a plotting program.  (Read 3482 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Dommy needs help with a plotting program.
« on: August 30, 2004, 04:04:31 PM »
I'm making a DCL/LISP routine that lets you pick by way of toggle boxes which plot output(s) you want.  We have 4: 24x36, 11x17, PDF, PLOT FILE.  I have made the DCL file, and most of the LISP.  It all works fine, no problem...but what I want to do now is take the choices made (from the toggles) and bring it to a confirm dialog that would show the choices made and have the "Yes/No/Cancel" buttons.  If "Yes" is selected, then execute the commands to make the plots.  If "No" is selected, then bring back to previous dialog to change output setting.  If "Cancel" is slelected, end the program.  A little direction I guess is all that is needed, for now.

I have changed the plot command to line commands in case anyone wanted to run it for testing.  I would upload them to the Lilly Pond...but no password  :evil:  :evil:  :evil:


LISP CODE
Code: [Select]

;;***********************************************
;;                 MPlot.lsp
;;          Created by Dominic Cesare
;;                 08/30/2004
;;***********************************************

;;**********************
;;Start of Routine
;;**********************

;informs user how to run lisp
(prompt "\nType MPLOT to run.....")


;define function
(defun c:MPLOT (/ dcl_id 11x17 24x36 PDF PLOT)
 
  ;load dialog
  (setq dcl_id (load_dialog "MPLOT.dcl"))
  ;test for dialog
  (if (not (new_dialog "main" dcl_id)
  );not
    ;exit if no dialog
    (exit)
    )

  (action_tile "tog1" "(setq 11x17 $value)")
  (action_tile "tog2" "(setq 24x36 $value)")
  (action_tile "tog3" "(setq PDF $value)")
  (action_tile "tog4" "(setq PLOT $value)")

  ;cancel button
  (action_tile
    ;if cancel button is pressed
    "cancel"
    ;close dialog, set flag
    "(done_dialog) (setq userclick nil)"
    );end action_tile Cancel

  ;O.K. button
  (action_tile
    ;if O.K. is pressed
    "accept"
    ;close dialog, set flag
    "(done_dialog) (setq userclick T))"
    );end action_tile O.K.

 
  ;start dialog
  (start_dialog)

  ;unload
  (unload_dialog dcl_id)

  (if userclick
    (progn
      (if(= 11x17 1)(command "line" "0,0" "50,0" ""))
      (if(= 24x36 1)(command "line" "0,20" "50,0" ""))
      (if(= PDF 1)(command "line" "0,40" "50,0" ""))
      (if(= PLOT 1)(command "line" "0,60" "50,0" ""))
      );progn

    ;not
    (alert "No output selected")
    );if

  (princ)
  );defun

;;**********************
;;End of Routine
;;**********************


DCL CODE:
Code: [Select]

//***********************************************
//                 MPlot.DCL
//          Created by Dominic Cesare
//                 08/30/2004
//***********************************************

//**********************
//Start of Dialog
//**********************

main : dialog {

label = "Multiple Plot Configuration";

: boxed_radio_row {
label = "Select necessary output media:";

: toggle {
key = "tg1";
label = "11x17";
action = "(setq 11x17 1)";
}

: toggle {

key = "tg2";
label = "24x36";
action = "(setq 24x36 1)";
}

: toggle {
key = "tg3";
label = "PDF File";
action = "(setq PDF 1)";
}

: toggle {
key = "tg4";
label = "Plot File";
action = "(setq PLOT 1)";
}

}

: row {
: paragraph {
: text_part {
label = "Dominic Cesare";
}
: text_part {
label = "08.27.2004";
}
}

ok_cancel;
}
}


//**********************
//End of Dialog
//**********************

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Dommy needs help with a plotting program.
« Reply #2 on: August 30, 2004, 06:48:14 PM »
Quote from: CAB
http://theswamp.org/phpBB2/viewtopic.php?t=2242 :roll:


Guess I missed that one...my bad...my bad...

M-dub

  • Guest
Dommy needs help with a plotting program.
« Reply #3 on: August 30, 2004, 06:49:05 PM »
Quote from: Dommy2Hotty
Guess I missed that one...my bad...my bad...


Welcome to MY world! ;) :roll:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Dommy needs help with a plotting program.
« Reply #4 on: August 30, 2004, 07:03:16 PM »
You could use something like this.
Code: [Select]
(setq loop   T  ; stay in loop
      action 1  ;do 1st action
)
(while Loop
  (cond
    ((= action 1)
      (get_plot_config) ; this is your routine
      ;;  set action to 2 upon exit
      ;;  set Loop to nil if user quit
    ) ; (= action 1)
    ((= action 2)
      (do_confirmation_dialog
      (cond
        ((= ans "Yes")
          ;;  plot drawing
        )
        ((= ans "No")
          (setq action 1); return to previous dialog
        )
        ((= ans "Cancel")
          (setq Loop nil); user quit
        )
      ); cond stmt Yes/No/Cancel
   ) ; (= action 2)
  ); cond stmt action
) ; end while
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Dommy needs help with a plotting program.
« Reply #5 on: August 31, 2004, 04:25:49 PM »
okay...here's my next problem...I'm trying to add the "Del_Pagesetups" lisp I got from here to this routine.  I've tried adding the whole lisp into mine at the beginning, the end, doesn't matter, won't work...I've tried just calling it from within my lisp...doesn't work...tried adding just the code for it without the defun to my lisp...doesn't work...how do I go about adding this?

EDIT: Here are the files....
MPlot.LSP
MPlot.DCL
Del_Pagesetups.LSP

Del_Pagesetups
Code: [Select]

;;  Function to delete all user plot set ups
(defun c:Del_Pagesetups (/ curdwg pslayout x)
  (vl-load-com)
  (setq
    curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
    pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
  ) ;_ end of setq
  ;; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
  (vla-RefreshPlotDeviceInfo pslayout)
  (vlax-for x (vla-get-Plotconfigurations curdwg)
    (vla-delete x)
  ) ;_ end of vlax-for
)               ; End Plot_config_list


My lisp:
Code: [Select]

;;***********************************************
;;                 MPlot.lsp                    *
;;          Created by Dominic Cesare           *
;;             Dommy2Hotty@aol.com              *
;;                 08/30/2004                   *
;;***********************************************

;;**********************
;;Start of Routine
;;**********************

;define function
(defun c:MPLOT (/ dcl_id PORT 11x17 24x36 PDF PLOT)

  (vl-load-com)
  (setq applic (vlax-get-acad-object))

  ;load dialog
  (setq dcl_id (load_dialog "MPlot.dcl"))
  ;test for dialog
  (if (not (new_dialog "main" dcl_id)
  );not
    ;exit if no dialog
    (exit)
    )

  (action_tile "tog1" "(setq PORT $value)")
  (action_tile "tog2" "(setq 11x17 $value)")
  (action_tile "tog3" "(setq 24x36 $value)")
  (action_tile "tog4" "(setq PDF $value)")
  (action_tile "tog5" "(setq PLOT $value)")

  ;cancel button
  (action_tile
    ;if cancel button is pressed
    "cancel"
    ;close dialog, set flag
    "(done_dialog) (setq userclick nil)"
    );end action_tile Cancel

  ;O.K. button
  (action_tile
    ;if O.K. is pressed
    "accept"
    ;close dialog, set flag
    "(done_dialog) (setq userclick T)"
    );end action_tile O.K.
 
  ;start dialog
  (start_dialog)

  ;unload
  (unload_dialog dcl_id)

  (if userclick
    (progn
     
      (if(= PORT 1)(command "-plot" "" "" "8.5x11-PORT-iR2200" "" "" "" ""))
      (if(= 11x17 1)(command "-plot" "" "" "11x17-FIT-iR2200" "" "" "" ""))
      (if(= 24x36 1)(command "-plot" "" "" "24x36-48-430" "" "" "" ""))
      (if(= PLOT 1)(command "-plot" "" "" "OCE 9600" "" "" "" "" ""))
      );progn

    ;not
    (vla-eval applic (strcat "MsgBox \"No output selected!!!\"" ", " "vbCritical" ", " "\"Multiple Plot\""))
    );if

  (princ)
  );defun


;;**********************
;;End of Routine
;;**********************


My DCL
Code: [Select]

//***********************************************
//                 MPlot.DCL
//          Created by Dominic Cesare
//                 08/30/2004
//***********************************************

//**********************
//Start of Dialog
//**********************

main : dialog {

label = "Multiple Plot Configuration";

: boxed_radio_row {
label = "Select necessary output media:";

: toggle {
key = "tg1";
label = "Portfolio";
action = "(setq PORT 1)";
}

: toggle {
key = "tg2";
label = "11x17";
action = "(setq 11x17 1)";
}

: toggle {

key = "tg3";
label = "24x36";
action = "(setq 24x36 1)";
}

: toggle {
key = "tg4";
label = "PDF File";
is_enabled = "false";
action = "(setq PDF 1)";
}

: toggle {
key = "tg5";
label = "Plot File";
action = "(setq PLOT 1)";
}

}

: row {
: paragraph {
: text_part {
label = "Dominic Cesare";
}
: text_part {
label = "08.30.2004";
}
}

ok_cancel;
}
}


//**********************
//End of Dialog
//**********************

JohnK

  • Administrator
  • Seagull
  • Posts: 10636
Dommy needs help with a plotting program.
« Reply #6 on: September 01, 2004, 08:56:07 AM »
The title of this thread is a obscure.

Dommy2Hotty, or a moderator want to try to rename this thread to something a little more fitting?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

daron

  • Guest
Dommy needs help with a plotting program.
« Reply #7 on: September 01, 2004, 09:00:44 AM »
Done. Dommy, if you don't like it, change it. Just hit edit on your initial post and you can change it.