I have run into my programing limitations so I am asking for help here Its probaly not the most elegant of solutuions ( I am sure a dat file would work just as well but that really goes over my head as far as coding goes) What I want to be able to do is draw a line at whatever distance is needed and have the routine chop the line into 20' segments wherein it then excutes the "drawpipe" function for each 20' segment and whatever remains. I have it where the pipe is drawn automatically at 20' regardless of the length specified so that the pipe is not longer than what is obtainable. I even have it setting the new start & end points for the next pipe but cant get to go to the function. Any & all help is greatly appreciated. Thanks Tim W. (defun aop (a) (* pi (/ a 180.0)) ) (defun pipecl () (initget 1) (setq sp (getpoint " Pick Start of Pipe: ")) (initget 1) (setq ep (getpoint sp " End point of pipe: " )) (setq pangle (angle sp ep)) (setq plength (distance sp ep)) (setq diam (getdist " Diameter of pipe in inches: <3 4 6 8 10 12> " sp)) (setq diam1 (/ diam 12)) (setq sdiam (* 1 diam1)) (setq shdiam (/ sdiam 2)) (setq diam1 (/ diam 12)) (setq sdiam (* 1 diam1)) (setq shdiam (/ sdiam 2)) (setq anga90 (+ pangle (aop 90))) ; Angle of pipe + 90 deg (setq angb90 (- pangle (aop 90))) ; Angle of pipe - 90 deg (if (> plength 20) (setq ep (polar sp pangle 20)) ) (setq rlength (- plength 20)) (setq nep (polar ep pangle rlength)) (cond ((= diam 3) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.745)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.245)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.245)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.245))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.245)) (setq p12 (polar sp anga90 (+ shdiam 0.245))) ) ) ((= diam 4) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.38)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.2133)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.2133)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.2133))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.2133)) (setq p12 (polar sp anga90 (+ shdiam 0.2133))) (setq sp ep) ) ) ((= diam 6) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.4633)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.2133)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.2133)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.2133))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.2133)) (setq p12 (polar sp anga90 (+ shdiam 0.2133))) ) ) ((= diam 8) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.5571)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.2288)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.2288)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.2288))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.2288)) (setq p12 (polar sp anga90 (+ shdiam 0.2288))) ) ) ((= diam 10) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.6506)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.2339)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.2339)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.2339))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.2339)) (setq p12 (polar sp anga90 (+ shdiam 0.2339))) ) ) ((= diam 12) (progn (setq sp1 (polar sp pangle 0.12)) (setq ep1 (polar ep pangle -0.12)) (setq p1 (polar sp angb90 0.745)) (setq p2 (polar p1 pangle 0.12)) (setq p3 (polar p2 anga90 0.245)) (setq p4 (polar ep1 angb90 shdiam)) (setq p5 (polar p4 angb90 0.245)) (setq p6 (polar p5 pangle 0.12)) (setq p7 (polar ep anga90 (+ shdiam 0.245))) (setq p8 (polar p7 pangle -0.12)) (setq p9 (polar ep1 anga90 shdiam)) (setq p10 (polar sp1 anga90 shdiam)) (setq p11 (polar p10 anga90 0.245)) (setq p12 (polar sp anga90 (+ shdiam 0.245))) ) ) );enf cond );end defun (defun drawpipe () (command "pline" p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 "c")) (defun centerl () (setq #CLE (getvar "clayer")) (if (null (tblsearch "layer" "Defpoints")) (command "layer" "m" "Defpoints" "c" "7" "" "") (command "layer" "s" "Defpoints" "" "") );end if (command "line" sp ep "") (setq ET (entlast)) (command ".Change" ET "" "P" "LT" "CENTER" "" ) (setvar "clayer" #CLE) ) (defun C:NPIPE () (pipecl) (centerl) (drawpipe) )