Search the Community
Showing results for tags 'selection sets'.
-
selection set based on layer and color of a given object
tsotzo posted a topic in AutoLISP, Visual LISP & DCL
Hi, I am trying something like this: (setq ed (entget (car (entsel)))) (setq lyr (cdr (assoc 8 ed))) (setq clr (cdr (assoc 62 ed))) How can I get a selection set based on layer and color of a given object? Something like: (setq objs (ssget "X" '((cons 8 lyr) (cons 62 clr)) ) ) [i know this is not working I write it just to give the idea.] and then change the objects' layer to "0" and color to 2. Thank you in advance tso- 5 replies
-
- selection sets
- by layer
-
(and 2 more)
Tagged with:
-
Hi Sirs, I'm just new on using autolisp and still learning so please help me on the dilemma i'm facing. Basically i want to sort a selection set of polyline (rectangle) under the layer of "REF" basing on it's X axis. I copied bits of info around the net but i can't get it work the way i want it to. Here is where i copied some of it. http://forums.augi.com/showthread.php?137837-Sort-Selectionset-by-X-coord (setq plt_set (ssget '((8 . "REF")))) ;select layer "REF" (setq count 1 count1 (sslength plt_set) ss6 (ssadd) ss4 (list (ssname plt_set (1- count))) ) (while (<= (1+ count) count1) ;SORT LIST BY X COORD LOW TO HIGH (setq ss3 (list (ssname plt_set count))) (setq ss4 (append ss4 ss3)) (setq count (1+ count)) ) ;_ end of while (vl-sort ss4 (function (lambda (a b) (> ;; or maybe > depending on the order you want (cadr (assoc 10 (entget a))) (cadr (assoc 10 (entget b))) ) ) ) ) (foreach ss5 (reverse ss4) (setq ss6 (ssadd ss5 ss6)) ) It is still sorting by the sequence of when it was created. Hoping for your kind help Cad Masters. Thank you, Ryan
-
Why does ssdel remove entities from other selection sets, and how to get around it?
benhubel posted a topic in AutoLISP, Visual LISP & DCL
I am writing a routine that requires that I remove objects from a selection set while still keeping the original set around. After running into issues, I created a test routine to see how ssdel is operating. I want it to remove selB from selC, while keeping selA and selD untouched to hold the original selection. It is removing selB from all related selection sets though. Why is it doing this, and how can I fix it? (defun c:TD () ;Test Delete (setq selA(ssget)) ;get base selection A (setq selB(ssget)) ;get selection B to remove from selection C (setq selC selA) ;copies selection A and removes selection B to return the difference (setq selD selA) ;extra variable to test how ssdel works (setq i 0) ;index (repeat (sslength selB) ;repeat for each entity in selB (ssdel (ssname selB i) selC) ;intended to remove selB from selC. It is also removeing selB from selA, which I don't want. (setq i (1+ i))) ;increment ) ;Functions below are used to test which geometry is contained in which selection set (defun c:dela () ;delete geometry in selection A (If(/= nil selA)(command ".erase" selA "")(princ "\n selA is empty. Run TD to initialize"))(princ)) ;if selA contains entities, delete them. If not, display error. (defun c:delb () ;delete geometry in selection B (If(/= nil selB)(command ".erase" selB "")(princ "\n selB is empty. Run TD to initialize"))(princ)) ;if selB contains entities, delete them. If not, display error. (defun c:delc () ;delete geometry in selection C (If(/= nil selC)(command ".erase" selC "")(princ "\n selC is empty. Run TD to initialize"))(princ)) ;if selC contains entities, delete them. If not, display error. (defun c:deld () ;delete geometry in selection d (If(/= nil selD)(command ".erase" selD "")(princ "\n selD is empty. Run TD to initialize"))(princ)) ;if selD contains entities, delete them. If not, display error.- 5 replies
-
- selection sets
- autolisp
-
(and 1 more)
Tagged with: