PDA

View Full Version : Pond contours


mikeosborne
2009-07-09, 11:07 PM
Hello,

this is my first lisp and I am trying to do something simple, create pond contours from a polyline. The idea is to give the routine the pond side slope(offset distance), a depth, and pick the top of bank(closed polyline). here is my code;


(defun c:PCA ()

(setq osd (getreal "\nPond Side Slope (H:1):")) ;Specify the side slope of the pond
(setq depth (getreal "\nPond Depth:")) ;Specify the depth of the pond
(setq pndtob (entsel "\nSelect Top of Bank")) ;Select a closed polyline
(setq pndcnt (getpoint "\nSelect Approxiamte Center of Pond:")) ;designates which side to make offset
(setq rerun 1)

(while (= rerun depth)
(setq pndcnt (getpoint pndcnt))
(command "offset" osd pndtob pndcnt)
(command "e")
(setq pndtob (entsel(entget(entlast))))
(setq rerun (1+ rerun))
)
)


If I remove the while statement it will offset the polyline one time if I leave the while statement in then I get "nil" and and the routine quits. what am I doing wrong?

ccowgill
2009-07-10, 01:40 PM
Hello,

this is my first lisp and I am trying to do something simple, create pond contours from a polyline. The idea is to give the routine the pond side slope(offset distance), a depth, and pick the top of bank(closed polyline). here is my code;


(defun c:PCA ()

(setq osd (getreal "\nPond Side Slope (H:1):")) ;Specify the side slope of the pond
(setq depth (getreal "\nPond Depth:")) ;Specify the depth of the pond
(setq pndtob (entsel "\nSelect Top of Bank")) ;Select a closed polyline
(setq pndcnt (getpoint "\nSelect Approxiamte Center of Pond:")) ;designates which side to make offset
(setq rerun 1)

(while (= rerun depth)
(setq pndcnt (getpoint pndcnt))
(command "offset" osd pndtob pndcnt)
(command "e")
(setq pndtob (entsel(entget(entlast))))
(setq rerun (1+ rerun))
)
)
If I remove the while statement it will offset the polyline one time if I leave the while statement in then I get "nil" and and the routine quits. what am I doing wrong?
I would think that you would want it to say
(while (<= rerun depth)

irneb
2009-07-13, 07:56 AM
Also, (setq pndtob (entsel(entget(entlast)))) will give an error. Why not simply use (setq pndtob (entlast)) instead?