Jump to content

Without Civil 3D, create an offset with a change of elevation


rcb007

Recommended Posts

I know in civil3d you can perform a stepped offset.

 

I am using vanilla autocad. I am trying to find a routine in which i can offset a pond from the waters edge. 

 

I did stumble upon this link, however I was not able to get the routine to work.

 

(defun c:PCA ()
;;https://forums.augi.com/showthread.php?104298-Pond-contours
  (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 pndtob (entlast))
    (setq rerun (1+ rerun))
    )
  )

 

Maybe there is an easier way to write this. Thank you for help.

 

Link to comment
Share on other sites

This should fix it. added an option for the center of pond point still ask for it. But you can right click to get the geocenter for the polyline picked right before. this will work for most boundary's. Odd shaped ones should be picked by hand.

 

;;----------------------------------------------------------------------------;;
;; POND OFFSET TOPO
(defun c:PCA (/ slope depth pndtob pndcnt pt c_pt)
  (setq slope (getdist "\nPond Side Slope 1:# "))      ;Specify the side slope of the pond
  (setq depth (getdist "\nPond Depth: "))              ;Specify the depth of the pond
  (setq pndtob (car (entsel "\nSelect Top of Bank: "))) ;Select a closed polyline
  (setq pndcnt (osnap (vlax-curve-getStartPoint pndtob) "gcen"))
  (entmake (list '(0 . "POINT") (cons 10 pndcnt)))
  (setq pt (entlast))
  (or (setq pndcnt (getpoint "\nSelect Approxiamte Center of Pond or [GeoCenter]: ")) (setq pndcnt (osnap (vlax-curve-getStartPoint pndtob) "gcen")))
  (setq c_pt (vlax-curve-getclosestpointto (vlax-ename->vla-object pndtob) pndcnt))
  (if (< (setq dist (fix (/ (distance pndcnt c_pt) slope))) depth)
    (prompt (strcat "\nMaximum Depth with slope [" (itoa dist) "]"))
    (progn
      (setvar 'cmdecho 0)
      (repeat (fix depth)
        (command "offset" slope pndtob pndcnt "_E")
        (setq pndtob (entlast))
        (setq elv (assoc 38 (setq plg (entget pndtob))))
        (entmod (subst (cons 38 (1- (cdr elv))) elv plg))    
      )
      (setvar 'cmdecho 1)
    )
  )
  (entdel pt)
  (princ)
)
Edited by mhupp
updated code
  • Like 1
Link to comment
Share on other sites

Thank you very much for fixing it. Could I ask how to make the polylines have an elevation to them? It seems to offset as its programed; just not sure about the z axis. Again, Thank you.

Link to comment
Share on other sites

13 hours ago, rcb007 said:

Thank you very much for fixing it. Could I ask how to make the polylines have an elevation to them? It seems to offset as its programed; just not sure about the z axis. Again, Thank you.

 

Sorry the other lisp didn't account for elevation either so I didn't think to add it since I don't work with topo drawings. also two aded two features. 1 it adds a temp point to where the geocenter of the pond is. allowing you to visually see and accept it or pick a better one. and depth error checking. from that point it will find the closest distance to the edge of pthe pond. do a little calculation and if the depth is to deep will give you a warning.

 

: PCA
Pond Side Slope [1:#] 15
Pond Depth: 50
Select Top of Bank
Select Approxiamte Center of Pond or [GeoCenter]: 
Maximum Depth with slope [24]

 

--edit

you might have to edit this line to get the right elevation change depending on what units your using.

 

(entmod (subst (cons 38 (1- (cdr elv))) elv plg))

Edited by mhupp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...