Lee,
I have tried to find a lisp in wich "xref sub entities" are put so the selection set. Did not find anything I can use or explore, .
I did find this code, from CAB, somewhere on the internet:
(At first the code worked, I don't know what I am doing wrong with that now, I dont work)
- (defun c:test (/ pk r lyr) (if (and (setq pk (getpoint "\nPick point to get lines.")) (setq r (getdist pk "\nEnter search distance.")) (setq lyr (getstring t "\nEnter layer name.")) ) (if (setq ss ([color=royalblue]get_lines[/color] r pk lyr))[color=red] (mapcar '(lambda (x) (print x)) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) )[/color] (prompt "\nNothing found.") ) ) (princ));; get lines crossing a rectangle 2*rad with pt as the center;; only on layer specified(defun get_lines (rad pt lay / ll ur) (setq ll (list (- (car pt) rad) (- (cadr pt) rad)) ur (list (+ (car pt) rad) (+ (cadr pt) rad)) ) (ssget "_C" ur ll ; look at the entire drawing, no user input ;; filter to follow (list '(0 . "LINE") ; get only lines (cons 8 lay) ; layer name (cons 410 (getvar "ctab")) ; current space only ) ))
As far as I know the return / result of this program is the entities name (in xref) that is closest to the point given. I see that there is a crossing used in the ssget part.
The blue part is executing the sub-function, so till that point I get it.
Then the red part, that I can't explain.
Somehow I am stuck, with everything. Can you help me out again?
I will again try to specify my needs:
1. Prompt for user input (getpoint)
2. Get nearest point on "anything" --> also XREF
Better to say: it will 99% be something (line / circle etc.) in an Xref.
Maybe 1% is not in an Xref... therefore "anything".
From there I will try my own way again.
The code from CAB is not what must be used but I guess that in this code is a usefull part, the red part. |