Author Topic: How to make the CAD command repeat? ? ?  (Read 1537 times)

0 Members and 1 Guest are viewing this topic.

xiaxiang

  • Guest
How to make the CAD command repeat? ? ?
« on: December 07, 2010, 03:08:26 AM »
Opinion:
      No matter what kind of program, CAD command  is the most!But while running the command, but also cumbersome press Enter,
What will be a lot of mess, annoying .........
Request:
      Want to know how to repeat the CAD commands , can you leave a message, or help, thank you! ! !
      If you don't press the space,  the command will automatically jump in the back after the implementation,
 But when pressing the space it will automatically exit !
      Who can do this for me,thanks a lot!
Code: [Select]
(setq *g-var* nil)
(defun userselect (/ string1 string2 num n showstr char TextList)
  (setq string1 "\n asign next action:[action1(A)/action2(B)/action3(C)]action1(A):"
        string2 "\n asign next action:[action1(A)/action2(B)/action3(C)]action2(B):"
  )
  (setq num 0)
  (while (< num 4)
    (if *g-var*
      (setq n *g-var*)
      (setq n 1)
    )
    (cond
      ((= n 1) (setq showstr string1))
      ((= n 2) (setq showstr string2))
    )
    (setq char (getstring showstr)
          TextList (list (cons "A" 1)
                         (cons "a" 1)
                         (cons "" n)
                         (cons "B" 2)
                         (cons "b" 2)
                         (cons "C" 4)
                         (cons "c" 4)
                   )
    )
    (if (assoc char TextList)
      (setq num (cdr (assoc char TextList)))
      (setq num 3)
    )
    (if (< num 3)
      (setq *g-var* num)
      (if (> num 3)
        (setq *g-var* 1)
      )
    )
    (cond
      ((= num 1) func1)
      ((= num 2) func2)
      ((= num 3) (princ "\n input valid,please input again."))
      ((= num 4) (princ))
    )
  )
)
 
« Last Edit: December 07, 2010, 03:28:57 AM by xiaxiang »

roy_043

  • Water Moccasin
  • Posts: 1876
  • BricsCAD 18
Re: How to make the CAD command repeat? ? ?
« Reply #1 on: December 07, 2010, 05:06:04 AM »
Why not use the command: MULTIPLE? :wink:

yarik

  • Newt
  • Posts: 32
Re: How to make the CAD command repeat? ? ?
« Reply #2 on: December 07, 2010, 12:02:13 PM »
Hi Xiaxiang

Maybe you can use the cmdactive variable

Something like

(while  (= 1 (logand (getvar "CMDACTIVE") 1))
(yourfunction)
)
I don't know if works but it`s a idea