thecocuk07 Posted January 17, 2023 Posted January 17, 2023 hello , I am sorry for my English Is there a lisp that can do something like the picture? Changing the text and mtext by operating on the selected text and mtext -Metric numbers in text and mtext example ; 10.025 , -10.025 (n) - add or subtract with the desired number (x) - results can be millimetric (no decimal) and + - symbol = n - x or n +x = + y or -y 10.025 -10.000 = +25 -10.025 +10.000 = -25 Quote
BIGAL Posted January 17, 2023 Posted January 17, 2023 As name implies -ve is ok. ; Adds a fixed amount to a number ; By Alan H (Alert "TO USE JUST TYPE A2L or A2LM for multiple ") ;(setvar "cmdecho" 1) (setq olddimzin (getvar "Dimzin")) (setvar "dimzin" 0) (DEFUN c:A2L ( / test en1 v1 a b el en1) (if (not AH:getvalsm)(load "Multi Getvals")) (setq v2 (Atof (nth 0 (AH:getvalsm (list "Add to levels" "Enter amount" 10 9 "1"))))) (setq test 1) (while (= test 1) (setq en1 (car (entsel "\nSelect text number:" ))) (if (/= en1 nil) (progn (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq a (+ v1 v2)) (setq b (rtos a 2 3)) (setq el (subst (cons 1 b) (assoc 1 el1) el1)) (entmod el) ; (entupd en1) );progn (princ "\nplease pick again"); else );if ); while true (setq el nil) (setq en nil) (setq a nil) (setq v1 nil) (setvar "cmdecho" 1) (setvar "dimzin" olddimzin) (princ) ); END a2l DEFUN (defun c:A2LM () (if (not AH:getvalsm)(load "Multi Getvals")) (setq v2 (Atof (nth 0 (AH:getvalsm (list "Add to levels" "Enter amount" 10 9 "1"))))) (setq ss (ssget (list (cons 0 "Text")))) (setq len (sslength ss)) (setq x 0) (repeat len (setq en1 (ssname ss x)) (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq a (+ v1 v2)) (setq b (rtos a 2 3)) (setq el (subst (cons 1 b) (assoc 1 el1) el1)) (entmod el) (setq x (+ x 1)) ); repeat (setq el nil ss nil) (setq en nil) (setq a nil) (setq v1 nil) (setvar "dimzin" olddimzin) (setvar "cmdecho" 1) (princ) ); END a2lm DEFUN Quote
thecocuk07 Posted January 18, 2023 Author Posted January 18, 2023 (edited) 7 hours ago, BIGAL said: As name implies -ve is ok. ; Adds a fixed amount to a number ; By Alan H (Alert "TO USE JUST TYPE A2L or A2LM for multiple ") ;(setvar "cmdecho" 1) (setq olddimzin (getvar "Dimzin")) (setvar "dimzin" 0) (DEFUN c:A2L ( / test en1 v1 a b el en1) (if (not AH:getvalsm)(load "Multi Getvals")) (setq v2 (Atof (nth 0 (AH:getvalsm (list "Add to levels" "Enter amount" 10 9 "1"))))) (setq test 1) (while (= test 1) (setq en1 (car (entsel "\nSelect text number:" ))) (if (/= en1 nil) (progn (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq a (+ v1 v2)) (setq b (rtos a 2 3)) (setq el (subst (cons 1 b) (assoc 1 el1) el1)) (entmod el) ; (entupd en1) );progn (princ "\nplease pick again"); else );if ); while true (setq el nil) (setq en nil) (setq a nil) (setq v1 nil) (setvar "cmdecho" 1) (setvar "dimzin" olddimzin) (princ) ); END a2l DEFUN (defun c:A2LM () (if (not AH:getvalsm)(load "Multi Getvals")) (setq v2 (Atof (nth 0 (AH:getvalsm (list "Add to levels" "Enter amount" 10 9 "1"))))) (setq ss (ssget (list (cons 0 "Text")))) (setq len (sslength ss)) (setq x 0) (repeat len (setq en1 (ssname ss x)) (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq a (+ v1 v2)) (setq b (rtos a 2 3)) (setq el (subst (cons 1 b) (assoc 1 el1) el1)) (entmod el) (setq x (+ x 1)) ); repeat (setq el nil ss nil) (setq en nil) (setq a nil) (setq v1 nil) (setvar "dimzin" olddimzin) (setvar "cmdecho" 1) (princ) ); END a2lm DEFUN thank you , Multi GETVALS.lsp works with lisp .... the result for example -0.005 or 0.005 ,,, for these results to be like this -5 or +5 (with the + icon) what do i need to change in lisp ? https://www.cadtutor.net/forum/topic/68861-lego-blocks/ Multi GETVALS.lsp Edited January 18, 2023 by thecocuk07 Quote
thecocuk07 Posted January 18, 2023 Author Posted January 18, 2023 10 hours ago, mhupp said: thank you , i have looked at this. but it deletes the decimal places ... +0.010 > 0.01 what i want +0.010 >> +10 Quote
mhupp Posted January 18, 2023 Posted January 18, 2023 Ah that's my bad thought these where the same. https://cadtips.cadalyst.com/notestext/run-calculations-numerical-text-and-mtext Allows you to pick how many decimal places you want. do your original math ± 8.400. Then you have to run again and multiple by 1000 to get +0.010 >> +10 Quote
thecocuk07 Posted January 18, 2023 Author Posted January 18, 2023 (edited) 2 hours ago, mhupp said: Ah that's my bad thought these where the same. https://cadtips.cadalyst.com/notestext/run-calculations-numerical-text-and-mtext Allows you to pick how many decimal places you want. do your original math ± 8.400. Then you have to run again and multiple by 1000 to get +0.010 >> +10 thank you , yes almost met my needs ,,, what to change to have + symbol at the start of positive results Edited January 18, 2023 by thecocuk07 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.