在这里找到。。。。。http://cadtips.cadalyst.com/notestext/run-calculations-numerical-text-and-mtext
你需要复习一下你的搜索技能。 没问题,将例程保存为sum2或其他格式,并进行以下更改:
第10行更改(setq sum 0。)to(setq sum 1)并在第27行中更改+登录*,et voila。。。
gr.Rlx 任何人都可以帮我。。。 发布您想要的图像或dwg “alanjt”的这首绝妙的Lisp程序可能正是你想要的:-
http://www.cadtutor.net/forum/showthread.php?46688-组合值。LSP加、除、乘、减对象值&
(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)
MathText。lsp
亲爱的rlx,谢谢
这个Lisp程序完全一样,它是完美的Lisp程序
再次感谢。。。。
亲爱的,您好,
谢谢你回答我的问题。。。。
很高兴2b able 2帮助:-)实际上很喜欢这个功能,考虑在我的VT应用程序中构建它。
Gr.Rlx
页:
1
[2]