YMG,
Thanks for telling me how to create the code windows... I had been wondering.
I had tried to use mk_3dp before I did the mk_bnd. It wasn't closing, so in the interest of simply demonstrating the code, I made mk_bnd. I now see how to close a poly and still use mk_3dp.
;; begin patch
(defun c:bnd (/ tmp grdmod grdval plst get_bnd) ;; was c:bound
(if (not csurf) (setq csurf "Natural Ground"))
(if (/= "" (setq tmp (getstring (strcat "\nCreate a Boundary for TIN <" csurf ">: "))))
(setq csurf tmp)
)
(mk_layer (list "Boundary" 2))
(setq grdval (getvar "elevation")) ; save preset elevation (normally 0.0)
(setq grdmod (getvar "OSNAPZ")) ; save elevation snap-mode
(setvar "OSNAPZ" 0) ; set snap to object-grade
(defun get_bnd (/ lst pt OK)
(if (car (setq lst (list (getpoint "\nFirst clockwise Boundary point: ")))) ;; if test
(progn
(while (setq pt
(if (> (length lst) 1)
(progn
(initget "Undo")
(getpoint (car lst) "\nNext clockwise Boundary point [Undo]: ")
) ;; end if=yes
(getpoint (car lst) "\nNext clockwise Boundary point: ")
) ;; end if length
) ;; end while test
(redraw)
(mapcar '(lambda (a b) (grdraw a b 1 1)) (setq lst (if (eq pt "Undo") (cdr lst) (cons pt lst))) (cdr lst))
) ;; end while
(cond ((> (length lst) 1) lst)) ;; post list
) ;; end progn if=yes
) ; end if
) ;; end _getpoints
(if (and (setq plst (get_bnd))
(if (> (length plst) 2)
(setq OK 1) ;; valid list
(alert "Boundary must exceed 2 points")
)
) ;; end test
(progn (if (equal (car plst) (last plst) 0.001)
(setq OK 1) ;; valid loop
(setq plst (append plst (list (car plst)))) ;; close loop
)
(mk_3dp plst)
(setq *bounden* (entlast))
(redraw)
) ;; end progn
) ;; end if
(setvar "OSNAPZ" grdmod) ; restore elevation snap-mode
(setvar "elevation" grdval) ; restore preset-elevation (normally 0.0)
;;(*error* nil) ;; no error catch implemented (I don't know what parameters should be used)
(princ)
) ;; end BND
;; end *upgrade patch*
I have kept the BND name so you can compare operation with BOUND. I haven't done the *error* catch because I don't know what parameters should be used with this type of poly.
I have done some testing on making boundaries that most user's would never do. They cut across where natural TIN's would be built, and in particular, through breaklines. The result is that it did not delete any TIN's that are contiguous to a breakline. I think that is proper.
But (still with the sloppy Boundary that I made) it appeared as if holes were left in the TIN in certain places against the Boundary. I couldn't get a TIN to highlight when I hovered over where I expected one to be. So I set the Boundary under the TIN's and the "hole TIN's" were there. The Boundary just overrode the object highlighting.
It seems that everything is proper. The contours built well.
Rick