I am trying to find a routine that will add up multiple 2 point distances looping until I hit enter to exit the command.
Example is the spaces between windows and doors along a single wall. I want to pick all the "wall" space points and have a total of wall.
I tried extracting the data to excel and it worked up until Excel's limitation of not adding feet-inch entries together for a sum.
Thanks in advance.
Rich
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Hi Rich,
I'm a metric guy, so feet-inch are not my world...
As a demo
(defun c:demo (/ d l p1 p2) (setq l 0.0) (while (and (setq p1 (getpoint "\nEnter first point: ")) (setq p2 (getpoint p1 "\nEnter second point: ")) ) (progn (setq d (distance p1 p2)) (prompt (strcat "\nTotal length: " (rtos (setq l (+ l d)) 3 2))) ) ) (prompt (strcat "\nTotal length: " (rtos l 3 2))) (princ) )
See the rtos function to the correct units.
Henrique
Here's a pair of commands I made a while ago. The one in SumDist.lsp is pretty much like hmsilva's except that it also reports each individual distance along the way. The one in SumDistCont.lsp is for a string of continuous end-to-end distances, sparing you the need, in that situation, to pick the intermediate locations twice [once for each sub-distance] as you would need to do if using SumDist.lsp.
EDIT: And now for some reason the Options are working again, so I can Edit. So in addition to the addendum in my other Reply:
In either hmsilva's or either of my routines, if you want to not just have the distance reported, but to be able to later use the total cumulative distance, such as to write it out to somewhere, but not within the distance-summing routine, take the variable name out of the localized variables list at the top [hmsilva's 'l', my 'sumdist'], so the variable value will survive past the completion of the routine. [If you alter the routines to incorporate writing it out within them, you can leave that as a localized variable.]
@Kent1Cooper wrote:
.... The one in SumDist.lsp is pretty much like hmsilva's except that it also reports each individual distance along the way. ....
[For some reason at the moment the Options thing isn't letting me Edit my Reply, so an addendum:]
It also reports the distances in whatever Units and precision are current, as compared to hmsilva's routine that reports only in Engineering units to 2 decimal places.
Thanks Kent. The "Pickpoints" option was created using Sumdist.lsp.
It works great.
I don't think I am explaining the issue clearly. Both potions work independently.
I'm trying to have two options and be able work with them back and forth as develop the gas line size calcs.
If I use the "Pickpoints" and then run using "Typeit", I get this message
"bad argument type: fixnump: 97.8481"
I need these to work together.
I have assembled the parts in a little lisp so you can see how it is supposed to work.
Thank you for your time.
If you posted a dwg would have helped maybe ssget "F" can give an answer only 2 points required. I auto dimension walls using that method.