@mhupp
Thanks - works perfectly!
1. first,I cannot overstate the importance of the code clarifications at the end of each line - thanks for that!
2. Since I can't guarantee that only straight lines will be involved, I decided to stick with the original function (SELECTINSIDE) rather than the simpler one you used in second example.
3. the missing link (sort of speaking...) for me was this line:
(while (> (getvar 'cmdactive) 0) (command pause)) ;pauses lisp until your done drawing the perimeter
4. And this line is also of great importance:
(if (and (setq poly (entlast)) (eq (cdr (assoc 0 (entget poly))) "LWPOLYLINE")) ;checks to see if entlast is also a polyline.
5. here is the final lisp I'm going to use:
(defun C:PJ (/ poly coord ss)
(prompt "Draw polyline: ") ;letting you/others to know what to do.
(vl-cmdf "_.pline") ;starts command
(while (> (getvar 'cmdactive) 0) (command pause)) ;pauses lisp until your done drawing the perimeter
(if (and (setq poly (entlast)) (eq (cdr (assoc 0 (entget poly))) "LWPOLYLINE")) ;checks to see if entlast is also a polyline.
;(if (setq poly (car (entsel "\nSelect Outside Polyline To Join Inside Object's ")))
(progn
(SELECTINSIDE poly)
(vl-cmdf "_.Join" SS2 "")
)
)
(entdel poly)
(princ)
)
(defun SELECTINSIDE (ent / poly obj seg lst len)
(setq poly (vlax-invoke (vlax-ename->vla-object ent) 'explode)) ;this creates an exploded copy of the polyline
(foreach obj poly ;steps though each segment of the exploded polyline to create the points list
(cond
((eq (vla-get-Objectname obj) "AcDbArc")
(setq seg (/ (vla-get-arclength obj) 5))
(setq lst (cons (vlax-curve-getPointAtDist obj 0) lst))
(setq len seg)
(repeat 4
(setq lst (cons (vlax-curve-getPointAtDist obj len) lst))
(setq len (+ len seg))
)
(vla-delete obj)
)
((eq (vla-get-Objectname obj) "AcDbLine")
(setq lst (cons (vlax-get obj 'StartPoint) lst))
(vla-delete obj)
)
)
)
(setq SS1 (ssget "_WP" lst))
(setq SS2 (ssget "_CP" lst))
)
MANY THANKS,
aridzv.