Jump to content

Recommended Posts

Posted

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))
 )
     )
   )

Posted
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

Posted
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

Posted

Heres another way (just wanted to have fun :P ) :

 

; (myfix PI)
(defun myfix ( n )
 (cond 
   ( (eq 'REAL (type n))
     (car (read (strcat "(" (vl-string-subst " " "." (rtos n 2 15)) ")")))
   )
   ( (numberp n) n )
 )
)

Posted

@Grrr:

(rtos 0.9999999999999999 2 15)

Posted
Heres another way (just wanted to have fun :P ) :

 

; (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 :ouch:

Posted
@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. :ouch:

 

 

please don't do that again , you've just upset my only remaining functional braincell :ouch:

 

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 "."). :P

I've seen that Lee wrote some generic subfunctions somewhere on his website.

Posted

I understood , this was just me having fun :D

 

 

ok , bad dragon , not funny! haha

Posted
Heres another way (just wanted to have fun :P ) :

 

; (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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...