Lisp lệnh QQ trong chủ đề “Làm sao để xoay trục 180 độ mà text không bị ngược?”
Cái này đúng hơn.
(defun c:qq( / get-x get-y oce xp yp rwc )
(setq oce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "luprec" 4)
(main)
(setvar "cmdecho" oce)
)
;;;----------------------------- xyz coordinate breakdown ----------------------
;;; This routine accepts a point from the calling function and breaks it down
;;; into X,Y values.
(defun get_xyz ( pt )
(strcat "(" (rtos (* 0.001 (car pt)) 2 3) ";" (rtos (* 0.001 (cadr pt)) 2 3) ")"))
;;;-------------------Secondary main module------------------------------------
;;; Accepts the user input and allows the user to select many objects in
;;; succession.
(defun main()
(setvar 'dimzin 8)
(setq olddim (getvar "dimstyle")
a (getreal (strcat "\n Input Text Height for Annotation <"
(if txtheight (rtos txtheight) (rtos (setq txtheight 2.5))) "> :"))
)
(if a (setq txtheight a))
(setvar 'dimtxt txtheight)
(while (setq rwc (getpoint "\nSelect point: "))
(setq xyp (get_xyz rwc)
rwc (trans rwc 1 0))
(command "ucs" "w")
(command "_.leader" rwc pause "" xyp "")
(command "ucs" "p")
)
(command "dimstyle" "restore" olddim)
)
Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.
Cách dùng
- Chép mã nguồn, lưu thành tệp 331684_qq.lsp.
- Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
- Gõ lệnh QQ để chạy lisp.
Mã nguồn 331684_qq.lsp (trích từ bài viết gốc)
(defun c:qq( / get-x get-y oce xp yp rwc )
(setq oce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "luprec" 4)
(main)
(setvar "cmdecho" oce)
)
;;;----------------------------- xyz coordinate breakdown ----------------------
;;; This routine accepts a point from the calling function and breaks it down
;;; into X,Y values.
(defun get_xyz ( pt )
(strcat "(" (rtos (* 0.001 (car pt)) 2 3) ";" (rtos (* 0.001 (cadr pt)) 2 3) ")"))
;;;-------------------Secondary main module------------------------------------
;;; Accepts the user input and allows the user to select many objects in
;;; succession.
(defun main()
(setvar 'dimzin 8)
(setq olddim (getvar "dimstyle")
a (getreal (strcat "\n Input Text Height for Annotation <"
(if txtheight (rtos txtheight) (rtos (setq txtheight 2.5))) "> :"))
)
(if a (setq txtheight a))
(setvar 'dimtxt txtheight)
(while (setq rwc (getpoint "\nSelect point: "))
(setq xyp (get_xyz rwc)
rwc (trans rwc 1 0))
(command "ucs" "w")
(command "_.leader" rwc pause "" xyp "")
(command "ucs" "p")
)
(command "dimstyle" "restore" olddim)
)
Thảo luận gốc
Lisp được chia sẻ trong chủ đề Làm sao để xoay trục 180 độ mà text không bị ngược?. Xem đúng bài viết #331684 để đọc hướng dẫn và trao đổi thêm.