马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
支持UCS,支持对齐点,文字高度,宽度比例系数,通用属性的匹配(层,颜色....)
 - (defun c:XDTB_addnum (/ #HorizontalMode #rotation #textsize #textstring
- #verticalmode #WidthFactor e eold nu num ss styl
- tf tol txt
- )
- (xdrx_begin)
- (setq tf t
- num 0.0
- )
- (if (not #XDTB_addnum_tol)
- (setq #XDTB_addnum_tol 2)
- )
- (if (setq tol (getint (xdrx_prompt "\n保留小数位数<" #XDTB_addnum_tol ">:"
- t
- )
- )
- )
- (setq #XDTB_addnum_tol tol)
- )
- (while (and
- tf
- (xdrx_initssget "\n选取求和的文字<退出>:")
- (setq ss (xdrx_ssget '((0 . "*TEXT"))))
- )
- (if ss
- (progn
- (xdrx_setsstodb ss 0)
- (while (setq e (xdrx_getentdata 0))
- (xdrx_getpropertyvalue e "textstring" "rotation"
- "HorizontalMode" "verticalmode"
- "WidthFactor" "textsize"
- )
- (setq styl (xdrx_getpropertyvalue e "textstyle"))
- (setq eold e
- txt (car (xdrx_string_split #textstring "\r\n"))
- )
- (if (setq nu (XD::String:ToNum (xdrx_string_trimright
- (xdrx_string_trimleft txt)
- )
- )
- )
- (progn
- (setq num (+ num nu))
- )
- )
- )
- (prompt (strcat "\n累加和:" (rtos num 2 #XDTB_addnum_tol)))
- (if (and
- (setq p0 (getpoint "\n插入点<退出>:"))
- (setq p0 (trans p0 1 0))
- txt
- )
- (progn
- (xdrx_text_make p0 (rtos num 2 #XDTB_addnum_tol)
- (car styl) #textsize (+ 0
- #rotation
- )
- )
- (xdrx_setpropertyvalue (setq e (entlast))
- "WidthFactor" #WidthFactor
- )
- (xdrx_entity_setpropertiesfrom e eold)
- (XD::Text:AdjustAlignMent e #HorizontalMode #verticalmode)
- (xdrx_entity_move e (xdrx_getpropertyvalue e "alignmentpoint")
- p0
- )
- )
- )
- )
- (setq tf nil)
- )
- )
- (xdrx_end)
- (princ)
- )
|