Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/15/2019 in all areas

  1. Try this. It asks you to construct a pline using grread and grdraw, and uses the coordinates from this to generate a list that can be fed into the fence selection of a selection set. You don't need to click inside every circle, just crossing part of it will do. The generated pline imitates the order of the previous line but connects the centres of the circles. (defun c:ssf_grl (/ *error* c_doc c_spc sv_lst sv_vals pt p_lst flg gr ss cnt v_lst ent) (defun *error* ( msg ) (mapcar 'setvar sv_lst sv_vals) (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred."))) (princ) );end_*error*_defun (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) sv_lst (list 'osmode 'cmdecho) sv_vals (mapcar 'getvar sv_lst) pt (getpoint "\nSelect the Start Point : ") p_lst (list pt) flg T );end_setq (mapcar 'setvar sv_lst '(0 0)) (princ "\nSelect the Next Point (or right click to exit) : ") (while (and (setq gr (grread T 12 0)) flg) ;;loops until flg = nil tracking cursor position (redraw) (grvecs (cons -1 (apply 'append (mapcar 'list p_lst (cdr p_lst))))) (cond ( (= 5 (car gr)) (grdraw (car p_lst) (cadr gr) 3 1)) ( (= 3 (car gr)) (setq p_lst (cons (cadr gr) p_lst)) (princ "\nSelect the Next Point (or right click to exit) : ") ) (T (redraw) (setq flg nil)) );end_cond );end_while (setq ss (ssget "F" (reverse p_lst) '((0 . "CIRCLE")))) (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) (vla-startundomark c_doc) (cond (ss (repeat (setq cnt (sslength ss)) (setq v_lst (cons (cdr (assoc 10 (entget (ssname ss (setq cnt (1- cnt)))))) v_lst)) );end_repeat (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (1+ (length v_lst)))) (mapcar '(lambda (x) (cons 10 x)) v_lst) );end_append );end_entmakex ) );end_cond (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc)) (mapcar 'setvar sv_lst sv_vals) (princ) );end_defun
    1 point
×
×
  • Create New...