sieuhongho Posted June 29, 2018 Posted June 29, 2018 (edited) Thank you to read my thread I have this code to plus dim and export to excel ... (defun c:ccd(/ gtt dt sdt ent id str) (setq dt (ssget '((0 . "DIMENSION"))) sdt (sslength dt) id 0 gtt 0 str "=" ) (repeat sdt (setq ent (ssname dt id) id (1+ id) gtt (+ gtt (gt1 ent) ) str (strcat str (Rtos (gt1 ent) 2 0 ) "+") ) ) (Lisped (substr str 1 (1- (strlen str)))) (princ (rtos gtt 2 0 )) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;; (defun gt1(ent / so) (if (wcmatch(cdr(assoc 1 (entget ent)))"") (setq so (cdr(assoc 42 (entget ent)))) (setq so (atof(cdr(assoc 1 (entget ent))))) ) ) this code work great but can someone fix to round up around 10 example : 3316--->3320 .... ; 3321--->3320 . Thank you for your help Edited July 9, 2018 by SLW210 Code Tags Quote
rlx Posted June 29, 2018 Posted June 29, 2018 see : http://www.lee-mac.com/round.html (defun LM:roundm ( n m ) (* m (atoi (rtos (/ n (float m)) 2 0)))) (LM:roundm 135.13 10) -> 140 (LM:roundm 134.13 10) -> 130 Quote
Roy_043 Posted June 29, 2018 Posted June 29, 2018 If I look at the code I see that rtos is used. This should correctly round the gtt value. Maybe the OP is confused by the dimensions in the dwg? For example: distance 1 = 4.6; dimension value = 5 distance 2 = 3.5; dimension value = 4 4.6 + 3.5 = 8.1; rounded value = 8 Quote
Roy_043 Posted June 30, 2018 Posted June 30, 2018 Disregard my previous post. I have misread the OP. Quote
sieuhongho Posted July 2, 2018 Author Posted July 2, 2018 see : http://www.lee-mac.com/round.html (defun LM:roundm ( n m ) (* m (atoi (rtos (/ n (float m)) 2 0)))) (LM:roundm 135.13 10) -> 140 (LM:roundm 134.13 10) -> 130 Thank you for reply my post . But im a newbie . Would u do me favor , add ur code to my code . Thank you very much Quote
SLW210 Posted July 9, 2018 Posted July 9, 2018 Please read the Code Posting Guidelines and have your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.