วันอาทิตย์ที่ 26 เมษายน พ.ศ. 2563

Run String / Number or String&Number



;|
      Run String / Number or String&Number
      Select Options 1 String 2 Number 3 String&Number
|;
(defun c:RST ()
(setq old_cmdecho  (getvar "cmdecho"))
(setvar "cmdecho" 0)
      (setq txtH (getvar "TEXTSIZE"))
      (setq txtS (getvar "textstyle"))
(initget "1 2 3")
      (setq opt (getkword "\mSelect Options : \n [1  String / 2  Number / 3  String&Number ] <1> "))
      (if (= opt "")(setq opt "1"))
      (if (or(= opt "1")(= opt "3"))(setq sta (getstring "\nEnter String : ")))
      (if (or(= opt "2")(= opt "3"))(setq nma (getreal "\nEnter Number : ")))
(while(setq pt (getpoint "\nPick Point :"))
      (if (= opt "1")
            (progn
                  (command "_.text" "_s" txtS "_j" "ml" pt txtH 0 sta)      
                  (setq sta (ascii sta)
                          sta (1+ sta)
                          sta (chr sta)
                  )
            )
      )
      (if (= opt "2")
            (progn
                  (command "_.text" "_s" txtS "_j" "ml" pt txtH 0 (rtos nma 2 3))
                  (setq nma (1+ nma))
            )
      )
      (if (= opt "3")
            (progn
                  (setq txt (strcat sta (rtos nma 2 3)))
                  (command "_.text" "_s" txtS "_j" "ml" pt txtH 0 txt)
                  (setq nma (1+ nma))
            )
      )    
      (princ)
);while     
(setvar "cmdecho" old_cmdecho)
(princ)
);end
(prompt "\nEnter RST to start. ")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น