Lee Mac 发表于 2022-7-5 20:18:23

fuqua 发表于 2022-7-5 20:20:29

thats a great tool ! but i need some adjusting to it, being a complete lisp noob myself i hope someone can help me.
 
i dont want it to show the nummer behind the dot ie: 123456.00 i just need the first row of numbers without the .00 part. anyone know how i can "demolish" this ?
 
also the text height is 267 (thats waaay to big) can anyone adjust this for me or tell me how ofcourse
 
thanx in advance.

jammie 发表于 2022-7-5 20:22:27

Hey Fuqua,
 
To covert a real number or an integer to a string the function RTOS is used. RTOS takes 3 argument (rtos number mode precision)
 
In your case you need to change the precision.
 
For example
 
(rtos pi 2 2) returns "3.14"
(rtos pi 2 0) returns "3"
 
The part of the code that needs to be updated is
 

(Make_Text (polar pt ang (* i Spc)) (rtos sNum* 2 2))

fuqua 发表于 2022-7-5 20:25:58

sweet thank you ! that did the trick
 
im having 1 more little problem, the justify is on center and left, i just need it to be left. As far as i can see there is no line in the lisp for this, can i add this to it ?

fuqua 发表于 2022-7-5 20:29:02

i have found this tool to change the justification of m and dtext i believe, but it is to much for me, all i need is 1 line to add to the autocounter tool to set the justify at left.
 

;                     ***JUSTIFY.LSP***;; Changes the justification of text to:-;       Left, Center, Right, Aligned, Middle, Fit,;       Bottom left, center or right,;       Middle left, center or right, OR;       Top left, center of right;(defun C:JUSTIFY (/ a a1 a2 a3 a4 t m n n1 p1                   p q j j0 n2 j1 j2 q1 index dummy) (setvar "cmdecho" 0) (graphscr) (prompt "\n *Select text to change justification...")(terpri) (setq t (ssget)) (if $just   (setq dummy nil)   (setq $just "C") ) (prompt "\n *Enter appropriate letter or select from pull down menu...") (initget "L C R A M F BL BC BR ML MC MR TL TC TR") (setq j1 (getkword (strcat   "\n *L/C/R/M/A/F/BL/BC/BR/ML/MC/MR/TL/TC/TR:"))) (if (= j1 "")   (setq j1 $just)   (setq $just j1) ) (setq m (sslength t)       index 0) (repeat m   (setq a (entget (ssname t index))         p (cdr (assoc 0 a)))   (if (= p "TEXT")   (progn      (setq j (assoc 72 a)            j2 (assoc 73 a)            p (assoc 10 a)            q (assoc 11 a)            j0 (cdr j))      (if (or (= j1 "L")(= j1 "C")(= j1 "R")(= j1 "M")                (= j1 "BL")(= j1 "BC")(= j1 "BR")                (= j1 "ML")(= j1 "MC")(= j1 "MR")                (= j1 "TL")(= j1 "TC")(= j1 "TR"))          (if (= j0 0)            (progn            (setq p1 (cdr p)                  q1 (cons (car q) p1)                  n1 (subst q1 q a))            )            (progn            (setq q1 (cdr q)                  p1 (cons (car p) q1)                  n1 (subst p1 p a))            )          )      )      (if (or (= j1 "A")(= j1 "F"))          (progn            (prompt "\n ")            (prin1 (+ index 1))            (setq a1 (getpoint "\nEnter first alignment point...")                  a2 (getpoint "\nEnter second alignment point...")                  a3 (cons (car p) a1)                  a4 (cons (car q) a2)                  n1 (subst a3 p a)                  n2 (subst a4 q n1))          )      )      (cond ((= j1 "L")(setq n (subst '(72 . 0) j n1))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "C")(setq n (subst '(72 . 1) j n1))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "R")(setq n (subst '(72 . 2) j n1))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "A")(setq n (subst '(72 . 3) j n2))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "M")(setq n (subst '(72 . 4) j n1))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "F")(setq n (subst '(72 . 5) j n2))                           (setq n (subst '(73 . 0) j2 n)))            ((= j1 "BL") (setq n (subst '(72 . 0) j n1))                           (setq n (subst '(73 . 1) j2 n)))            ((= j1 "BC") (setq n (subst '(72 . 1) j n1))                           (setq n (subst '(73 . 1) j2 n)))            ((= j1 "BR") (setq n (subst '(72 . 2) j n1))                           (setq n (subst '(73 . 1) j2 n)))            ((= j1 "ML") (setq n (subst '(72 . 0) j n1))                           (setq n (subst '(73 . 2) j2 n)))            ((= j1 "MC") (setq n (subst '(72 . 1) j n1))                           (setq n (subst '(73 . 2) j2 n)))            ((= j1 "MR") (setq n (subst '(72 . 2) j n1))                           (setq n (subst '(73 . 2) j2 n)))            ((= j1 "TL") (setq n (subst '(72 . 0) j n1))                           (setq n (subst '(73 . 3) j2 n)))            ((= j1 "TC") (setq n (subst '(72 . 1) j n1))                           (setq n (subst '(73 . 3) j2 n)))            ((= j1 "TR") (setq n (subst '(72 . 2) j n1))                           (setq n (subst '(73 . 3) j2 n)))      )      (entmod n)   )   )   (setq index (+ index 1)) ) (prin1) (princ "    Changed ")                ; Print total lines changed (princ index) (princ " text lines.") (terpri) (princ))

fuqua 发表于 2022-7-5 20:33:39

nevermind i figured it out myself
 
this piece of code gave the justify codes for a positions
 

(cond ((= j1 "L")(setq n (subst '(72 . 0) j n1))                           (setq n (subst '(73 . 0) j2 n)))
 
so i looked up in the auto count tool for something similar and found this
 

(cons 7 (getvar "TEXTSTYLE"))      '(71 . 0)      '(72 . 1)      '(73 . 2)
 
i changed this to

(cons 7 (getvar "TEXTSTYLE"))      '(71 . 0)      '(72 . 0)      '(73 . 0)
 
and i got me justify on bottom left
 
i hope this piece of info helps others, cheers all.

Lee Mac 发表于 2022-7-5 20:36:45

Nice one Jammie. I will hopefully be updating this routine in due course.

Scrimski 发表于 2022-7-5 20:40:07

readded

(defun c:num(/ tmpVars pt ang sNum*) (setq dVars '(sNum eNum inNum Spc Pref Suff tsize Dir)) (mapcar '(lambda (x y) (or (boundp x) (set x y))) dVars '(1 10 1 1 "" "" 2.5 "X")) (setq tmpVars (list (getreal (strcat "\nSpecify Starting Number : "))                     (getreal (strcat "\nSpecify Ending Number : "))                     (getreal (strcat "\nSpecify Increment : "))                     (getreal (strcat "\nSpecify Spacing : "))             (if (=(setq tmppref (getstring (strcat "\nSpecify Prefix : "))) "") Pref tmppref)                     (if (=(setq tmpsuff (getstring (strcat "\nSpecify Suffix : "))) "") Suff tmpsuff)             (if (not(setq tmptsize (getreal (strcat "\nSpecify Textsize : ")))) tsize tmptsize)             ))                (initget "X Y") (setq tmpVars   (append tmpVars (list (getkword (strcat "\nSpecify Direction : "))))) (mapcar '(lambda (x y) (or (not x) (set y x))) tmpVars dVars) (if (eq Dir "X") (setq ang 0) (setq ang (/ pi 2))) (if (setq pt (getpoint "\nSpecify Start Point: ") i 0 sNum* sNum)   (while (

AQucsaiJr 发表于 2022-7-5 20:41:32

This works great... One question though... What would I type in the prefix and suffix if I want it to be blank?

AQucsaiJr 发表于 2022-7-5 20:46:23

Another question.... How would I get the numbers, in the vertical Y form, to go from 1 to whatever, from top to bottom rather than bottom to top, as it is doing now?
页: 1 [2]
查看完整版本: 自动编号?