Originally Posted by
kylehalchin
1. What I would like to do is be able to select a bunch of featurelines that all have a lot of elevation points and then delete all elev points at once instead of going thru each line individually. Does anyone know of a lisp out there that will delete all elevation points (not PI points) of multiple/all featurelines or 3D polyines? Or a better workflow?
Code:
(vl-load-com)
(defun c:RemoveElevPoints (/ *error* _MakePoints acDoc ss elevPoints)
(defun *error* (msg)
(if ss (vla-delete ss))
(if acDoc (vla-endundomark acDoc))
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(defun _MakePoints (data / pt i pts)
(while data
(setq i 3)
(while (and data (< 0 i))
(setq pt (cons (car data) pt))
(setq data (cdr data))
(setq i (1- i))
)
(setq pts (cons (reverse pt) pts))
(setq pt nil)
)
(reverse pts)
)
(if (ssget "_:L" '((0 . "AECC_FEATURE_LINE")))
(progn
(vla-startundomark
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
(vlax-for x (setq ss (vla-get-activeselectionset acDoc))
(while
(and
(setq elevPoints (vlax-invoke x 'getpoints 2))
(setq elevPoints (_MakePoints elevPoints))
)
(foreach ep elevPoints
(vlax-invoke x 'deletefeaturepoint ep)
)
)
)
)
)
(*error* nil)
)
Originally Posted by
kylehalchin
2. And on the flip side...does anyone know of a lisp that would add elevation points to a bunch of featurelines at a given interval all at once (instead of one individual line at a time)?
Code:
(vl-load-com)
(defun c:InsertElevPointsAt (/ *error* _MakePoints i acDoc ss e d pts n ep name)
(defun *error* (msg)
(if ss (vla-delete ss))
(if acDoc (vla-endundomark acDoc))
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(defun _MakePoints (data / pt i pts)
(while data
(setq i 3)
(while (and data (< 0 i))
(setq pt (cons (car data) pt))
(setq data (cdr data))
(setq i (1- i))
)
(setq pts (cons (reverse pt) pts))
(setq pt nil)
)
(reverse pts)
)
(if
(and
(ssget "_:L" '((0 . "AECC_FEATURE_LINE")))
(not (initget 6))
(setq i (getreal "\nEnter the increment to add EPs: "))
)
(progn
(vla-startundomark
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
(vlax-for x (setq ss (vla-get-activeselectionset acDoc))
(setq e (vlax-vla-object->ename x))
(setq d 0)
(setq pts (vlax-invoke x 'getpoints 3))
(setq pts (_MakePoints pts))
(setq n 0)
(while
(and
(setq ep (vlax-curve-getpointatdist e (setq d (+ d i))))
(not (vl-position ep pts))
)
(progn
(vlax-invoke x 'insertfeaturepoint ep 2)
(setq n (1+ n))
)
)
(prompt
(strcat
"\nFeature Line \""
(if (= "" (setq name (vla-get-name x)))
(vla-get-handle x)
name
)
"\" : Inserted "
(itoa n)
" elevation points. "
)
)
)
)
)
(*error* nil)
)