TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: carmi on July 09, 2021, 06:21:18 AM
-
Hi all,
i want to change this lisp and insert text at center.
I think i have to change text alignment to center but im not able.
Can you help me?
thank you very much
(defun C:AP2 ( / a e1 ar ptx Text)
(print)
(setq a (getpoint "\nSelect Internal Point: "))
(command "-Boundary" a "")
(setq e1 (entlast))
(command "_pedit" e1 "_C" "")
(setq ar (vlax-curve-getarea e1))
(command "-ERASE" e1 "")
(setq ptx (getpoint "\n select point "))
(setq Text (strcat "s.n. = " (rtos ar 2 2) " mq"))
(command "-text" ptx "0.15" "0" Text)
)
(vl-load-com) (princ)
-
Maybe like this.
(defun C:AP2 ( / a e1 ar ptx Text)
(vl-load-com)
(setvar "cmdecho" 0)
(command "_undo" "_begin")
(print)
(setq a (getpoint "\nSelect an Internal Point: "))
(command "_.Boundary" a "")
(setq e1 (entlast))
;;; (command "_.pedit" e1 "_C" "") ;;; I donīt think you need this
(setq ar (vlax-curve-getarea e1))
(command "_.ERASE" e1 "")
(setq ptx (getpoint "\n select point "))
(setq Text (strcat "s.n. = " (rtos ar 2 2) " mq"))
(command "_.text" "j" "mc" ptx "0.15" "0" Text)
(command "_undo" "_end")
(princ)
)
-
There is a geom centre snap
(setq obj (vlax-ename->vla-object (entlast))) ; do after bpoly or boundary
(setq ptx (osnap (vlax-curve-getStartPoint obj) "gcen"))
-
thank to all,
i simply add this line:
(command "_.text" "j" "mc" ptx "0.15" "0" Text)
Now, how can change the text who insert, in a new layer named "Text_area" with yellow color?
Thank you very much
-
Insert this line before you make the text
(command "_.layer" "n" "Text_area" "c" "2" "Text_area" "l" "Continuous" "Text_area" "s" "Text_area" "")