Combine Rotines

Combine Rotines

Anonymous
Not applicable
379 Views
1 Reply
Message 1 of 2

Combine Rotines

Anonymous
Not applicable

I am going to combine couple of lisp routines in a way that at the end of functioning of my first lisp, instead of closing the routine, it asks to run other lisps (via opening a DCL or on the fly selection from command menu) and get a selection options to choose from.

For example, for attached lisps I want to run STAMP.LSP first but before EXIT it opens clup.dcl and give me the option to run another two lisps(i'm not sure it can be done by mouse-reactor or Esc can do it as well)

Thanks

0 Likes
380 Views
1 Reply
Reply (1)
Message 2 of 2

smaher12
Advocate
Advocate

 

(defun C:STAMP (/ cdate ss edata ename)
  (setvar "userr1" 0)
  (setq cdate (rtos (getvar "cdate") 2 6)
        cdate 
    (strcat
       (cdr (assoc (substr cdate 5 2) 
          '(("01" . "Jan")
            ("02" . "Feb")
            ("03" . "Mar")
            ("04" . "Apr")
            ("05" . "May")
            ("06" . "Jun")
            ("07" . "Jul")
            ("08" . "Aug")
            ("09" . "Sept")
            ("10" . "Oct")
            ("11" . "Nov")
            ("12" . "Dec"))))
       " "
       (substr cdate 7 2)
       ", "
       (substr cdate 1 4)
       " - "
       (substr cdate 10 2)
       ":"
       (substr cdate 12 2)
       ":"
       (substr cdate 14 2)
       "    DWG Name: "
       (getvar "dwgname")
       ".DWG"
       "  Updated By: "
       (getvar "loginname")
     )
  )
  (if 
    (setq ss (ssget "X" '((0 . "INSERT") (2 . "STAMP"))))
    (progn
      (setq ename (entnext (ssname ss 0))
            edata (entget ename)
            edata (subst (cons 1 cdate) (assoc 1 edata) edata)
      )
      (entmod edata)
      (entupd ename)
    (PROMPT "\nStamp Modified as Follows: ")
    (princ cdate)
    )
    (progn
      (princ "\nSTAMP block not found.\n")
      (initget "Y N")
      (setq ans (getkword "Insert <Y/N>:"))
      (if (= ans "Y")
      (progn
      (setq ins (getpoint "\nEnter Insertion point: "))
      (command "INSERT" "STAMP" ins (*(getvar "LtScale")0.5) (*(GETVAR "LTSCALE")0.5) "0" cdate))
      )
     )
  )

 (setq dcl_id (load_dialog "stamp.dcl"))
  (if (not (new_dialog "stamp" dcl_id))
    (exit)
  )

  (action_tile "deldim" "(done_dialog 2)")
  (action_tile "accept" "(done_dialog)")
  (action_tile "cancel" "(exit)")
  (setq flag (start_dialog))

  (if (= flag 2) 
    (deldim)
  )
    (unload_dialog dcl_id)

 (princ)
); end stamp


(defun deldim (/ ss)
  (setq ss (ssget "x" (list (cons 0 "Dimension"))))
  (if ss
    (vl-cmdf ".erase" ss "")
    (princ "\nNo dimensions in this drawing!")
  )
  (princ)
)

 

 

stamp : dialog {

        label = "Sample Dialog Box";

	: boxed_column {

	: button {
	label = "Delete Dim";
	key = "deldim";
	width = 10;
	}

	: button {
	label = "Test 1";
	key = "test1";
	width = 10;
	}

	} // end box_column

	ok_cancel;

	 } // end sample dialog

 

0 Likes