Assist with stored variable numbers??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I know I'm going to get beat up for my crappy programming, but here goes.
I have a gas line sizing tool we use. I am trying to add a select points to gather lengths option in addition to the command line entry version that remembers the previous value.
I have it working as long as do not revert back to other method (Typeit ot Pickpoints). If I start with Typeit, it works great, go to Pickpoints, works great, go back to Typeit, fails or visa versa???
When I look at the results using (princ)
Typeit = 123
Pickpoints = 123.0
I've played with atoi, itoa... I do not know how to solve this although seems simple??
See lisp below.
-------------------------------------------------------------------------------------
(defun DO_GET_LEN (/ P1 P2)
(setq GET_LEN 0)
(while (setq P1 (getpoint "\nSelect first point, or press Enter to close: "))
(setq P2 (getpoint P1 "\nSelect second point: "))
(prompt
(strcat
"\nLatest distance = "
(rtos (distance P1 P2))
",\nCumulative distance = "
(rtos (setq GET_LEN (+ GET_LEN (distance P1 P2))))
); end strcat
); end prompt
); end while
(prompt (strcat "\nTotal sum of distances = " (rtos GET_LEN)))
(setq GET_LEN (/ GET_LEN 12))
;(setq GET_LEN (atoi (rtos (/ GET_LEN 12) 2 0)));test
;(setq GET_LEN (itoa (rtos (/ GET_LEN 12) 2 0)));test
(princ GET_LEN)
(princ)
); end defun
-------------------------------------------------------------------------------------
Thanks in advance for your assistance / input.
-DC