Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/22/2023 in all areas

  1. I do same as Steven P with 1 little change (if (< pre 10)(setq tmp "00"))
    1 point
  2. This is what I use for leading 0's (defun AT:NumFix (s n) ;; Fix number string with leading zeros ;; s - Number string to fix ;; n - Number of characters for final string ;; Alan J. Thompson, 10.29.09 ;; (AT:NumFix i 3) i= 1 = 001 (if (< (strlen s) n) (AT:NumFix (strcat "0" s) n) s ) ) (defun c:test (/ pre tmp) (if (and (setq pre (getint "Enter Drawing Number: ")) (> pre 0) (< pre 999)) (setq tmp (AT:NumFix (itoa pre) 3)) (Alert "\nNumber must be in the range 001-999.") ) tmp )
    1 point
  3. My first thought was to use getint, below works if you want the file number to have leading zeros (for numbers below 100). (defun c:test ( / tmp pre) (setq tmp "") (setq pre (getint "Enter Drawing Number: ")) (if (< pre 10)(setq tmp "0")) (if (< pre 100)(setq tmp (strcat tmp "0"))) (setq pre (strcat tmp (rtos pre))) )
    1 point
×
×
  • Create New...