ReMark 发表于 2022-7-5 18:54:04

MathText。lsp
 
在这里找到。。。。。http://cadtips.cadalyst.com/notestext/run-calculations-numerical-text-and-mtext
 
你需要复习一下你的搜索技能。

rlx 发表于 2022-7-5 18:56:07

没问题,将例程保存为sum2或其他格式,并进行以下更改:
 
 
第10行更改(setq sum 0。)to(setq sum 1)并在第27行中更改+登录*,et voila。。。
 
 
gr.Rlx

CAD USER 发表于 2022-7-5 19:00:43

任何人都可以帮我。。。

BIGAL 发表于 2022-7-5 19:02:01

发布您想要的图像或dwg

Manila Wolf 发表于 2022-7-5 19:05:29

“alanjt”的这首绝妙的Lisp程序可能正是你想要的:-
 
http://www.cadtutor.net/forum/showthread.php?46688-组合值。LSP加、除、乘、减对象值&

rlx 发表于 2022-7-5 19:10:20

 
 



(defun C:STM (/ cpent elist en ip newtxt pt ss sum sumtxt txt)
(princ "\n\t\t>>>Select text to get summ >>>")
(if
;;select texts/mtexts on screen :
(setq ss (ssget '((0 . "*TEXT"))))
;; if selected then :
(progn
;; store the first text entity for using 'em further :
(setq cpent (ssname ss 0))
;; set initial sum to zero :
(setq sum 1)
;; loop trough selected texts/mtexts :
(while
   ;; get the first text in selection :
   (setq en (ssname ss 0))
   ;; get entity list of them :
   (setq elist (entget en))
   ;; get the textstring by key 1 from entity list :
   (setq txt (cdr (assoc 1 elist)))
   ;; create output string :
   (setq sumtxt
   ;; concatenate strings :
   (strcat
   ;; convert digits to string :
   (rtos
       ;; add to summ the digital value of text :
       (setq sum (* (atof txt) sum))
       ;; 2 is for metric units (3 for engineering) :
       2
       ;; set precision by current :
       (getvar "dimdec")))
)
   ;; delete entity from selection set :
   (ssdel en ss)
   )
;; display message in the command line:
(princ (strcat "\nSumm=" sumtxt))
(setq pt (getpoint "\nSpecify the new text location: "))
;; get the insertion point of stored entity :
(setq ip (cdr (assoc 10 (entget cpent))))
;; copy text entity to the new destination point :
(command "_copy" cpent "" ip pt)
;; get the last created entity :
(setq newtxt (entlast))
;; get entity list of them :
(setq elist (entget newtxt))
;; modify entity list with new text string :
(entmod (subst (cons 1 sumtxt)(assoc 1 elist) elist))
;; update changes :
(entupd newtxt)
)
)
(princ)
)
(princ "\nStart command with STM")
(princ)


ReMark 发表于 2022-7-5 19:12:29

 
MathText。lsp

CAD USER 发表于 2022-7-5 19:14:59

 
亲爱的rlx,谢谢
 
这个Lisp程序完全一样,它是完美的Lisp程序
再次感谢。。。。

CAD USER 发表于 2022-7-5 19:20:15

 
亲爱的,您好,
谢谢你回答我的问题。。。。

rlx 发表于 2022-7-5 19:21:23

 
很高兴2b able 2帮助:-)实际上很喜欢这个功能,考虑在我的VT应用程序中构建它。
 
Gr.Rlx
页: 1 [2]
查看完整版本: Lisp用于文本乘法