ktbjx Posted January 23, 2018 Posted January 23, 2018 no rounding up or down.. i just want to remove the numbers after the decimal point. i dont know how to do it??? can you please tech me? (defun c:YCoord (/ ss d i e el start_point new_start_point) (vl-load-com) (setq ss (ssget "_:L" '((0 . "LINE")))) (setq i 0) (setq e (ssname ss i)) (setq el (entget e)) (setq start_point (assoc 10 el)) (setq new_start_point (caddr start_point )) (and (setq obj (car (entsel "\nPick text object :"))) (setq obj (vlax-ename->vla-object obj)) (wcmatch (vla-get-objectname obj) "AcDb*Text") (vla-put-textstring obj (strcat "Y "(rtos new_start_point)) ) ) ) Quote
Steven P Posted January 23, 2018 Posted January 23, 2018 I haven't checked but would int (integer) help: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-AutoLISP/files/GUID-EF6114FC-F1E4-4C71-91CC-07D01E6C8ABB-htm.html Quote
ktbjx Posted January 23, 2018 Author Posted January 23, 2018 how about (itoa (fix 3.14)) AMEN! thank you sir! lol so thats how you use FIX >. to be honest i dont understand my code. i just copy and paste other peoples codes and figure out what those codes do Quote
rlx Posted January 23, 2018 Posted January 23, 2018 to be honest i dont understand my code. i just copy and paste other peoples codes and figure out what those codes do Trust me , you're not alone on this forum haha Quote
Grrr Posted January 23, 2018 Posted January 23, 2018 Heres another way (just wanted to have fun ) : ; (myfix PI) (defun myfix ( n ) (cond ( (eq 'REAL (type n)) (car (read (strcat "(" (vl-string-subst " " "." (rtos n 2 15)) ")"))) ) ( (numberp n) n ) ) ) Quote
rlx Posted January 23, 2018 Posted January 23, 2018 Heres another way (just wanted to have fun ) : ; (myfix PI) (defun myfix ( n ) (cond ( (eq 'REAL (type n)) (car (read (strcat "(" (vl-string-subst " " "." (rtos n 2 15)) ")"))) ) ( (numberp n) n ) ) ) please don't do that again , you've just upset my only remaining functional braincell Quote
Grrr Posted January 23, 2018 Posted January 23, 2018 @Grrr:(rtos 0.9999999999999999 2 15) DOH! So its not fully reliable - reminds me of this thread, so it accounts (rtos 4.2 2 15) or (rtos 1.0 2 15) but not the 0.9999.. you mentioned. please don't do that again , you've just upset my only remaining functional braincell Rlx, the (read (strcat "(" ... ")")) is a common DCL technique, mostly used for actions that include list_boxes. I've just translated the dot "." to space " ", so the list would have two items (before and after the "."). I've seen that Lee wrote some generic subfunctions somewhere on his website. Quote
rlx Posted January 23, 2018 Posted January 23, 2018 I understood , this was just me having fun ok , bad dragon , not funny! haha Quote
ktbjx Posted January 23, 2018 Author Posted January 23, 2018 Heres another way (just wanted to have fun ) : ; (myfix PI) (defun myfix ( n ) (cond ( (eq 'REAL (type n)) (car (read (strcat "(" (vl-string-subst " " "." (rtos n 2 15)) ")"))) ) ( (numberp n) n ) ) ) OK im lost, lol I'm sorry 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.