치수합 구하는 리습입니다. 구글 검색…
소수점 아래 한자리를 없애고 싶습니다.
1000.0 –>1000
부탁드립니다. 감사합니다.
;; Select Dimensions or Text Numbers.
;; A right mouse button click (if set to enter) or press enter to end selection.
;; Be aware discrepancies may arise due to rounding required
(defun c:dss (/ c_doc ent ss t_lst xport_str fn file txt_num)
(prompt “nPick Text numbers to add : “)
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
ent (ssget ‘((0 . “TEXT,DIMENSION”)))
ss (vla-get-activeselectionset c_doc)
xport_str “”
)
(vlax-for obj ss
(setq txt_num nil)
(cond ( (wcmatch (vla-get-objectname obj) “*Dimension”)
(if (/= (vla-get-textoverride obj) “”)
(setq txt_num (atof (vla-get-textoverride obj)))
(setq txt_num (vla-get-measurement obj))
)
)
( (wcmatch (vla-get-objectname obj) “*Text”)
(setq txt_num (atof (vla-get-textstring obj)))
)
)
(if txt_num
(progn
(setq t_lst (cons txt_num t_lst))
(if (= (strlen xport_str) 0)
(setq xport_str (strcat xport_str (rtos txt_num 2 1)))
(setq xport_str (strcat xport_str “+” (rtos txt_num 2 1)))
)
)
)
)
(setq xport_str (strcat xport_str “=” (rtos (apply ‘+ t_lst) 2 1))
ss nil
fn (strcat (getvar “dwgprefix”) “Dimension Export Report.txt”)
file (open fn “a”); append
)
(write-line “” file)
(princ xport_str file)
(close file)
(startapp “notepad.exe” fn)
(princ)
)
;(c:ds)
(princ)
rtos 의 소수점 0 억제 비억제 방법 : 네이버 블로그 (naver.com)
정말 정말 감사합니다. 감사합니다.