round up numbers using autolisp

round up numbers using autolisp

Anonymous
Not applicable
1,863 Views
2 Replies
Message 1 of 3

round up numbers using autolisp

Anonymous
Not applicable
Please how can I roundup numbers using autolisp code. for example : 1860 -> 2000 2200 -> 2500 2000-> 2000 3450 -> 3500 it is for bar length and I want to be like : 1000 - 1500 - 2000 - 2500 ... millimeter thanks in advance.
0 Likes
1,864 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant

Check this out.

Kent Cooper, AIA
0 Likes
Message 3 of 3

3wood
Advisor
Advisor

You can also try ALTEXT.

Save codes below as a lsp file. Select "Use formula" in ALTEXT settings, and use the lsp file as the formula.

;;; This is an example formula for ALTEXT.vlx
;;; Round up selected numbers to nearest markers.
;;; Change value of RoundUp to suit
(defun ALTEXT_FORMULA (/ RoundUp f1 f2)
  (setq RoundUp 500
	f1 (/ (atof ALTEXT_STR_ORG) RoundUp)
	f2 (fix f1)
	)
  (itoa (if (= f1 f2)
	  (* f2 RoundUp)
	  (* (1+ f2) RoundUp)
	  )
	)
  )

 

0 Likes