Author Topic: easy filter  (Read 8397 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
easy filter
« on: July 09, 2004, 09:01:59 PM »
Command: (setq ss (ssget '(0 . "LINE")(6 . "Continuous"))))
; error: bad argument type: consp "Continuous"
Code: [Select]

I'm trying to make a sel set of "lines" that are "continuous" no matter what i capture in a crossing window....this line of code does not seem to work
any idea's on a friday evening ...boy 4-5 years ago this would be the last thing i would be thinking about on a friday evening.....   :shock:

rude dog

  • Guest
easy filter
« Reply #1 on: July 09, 2004, 09:18:17 PM »
ok..it seems to work better with :
Code: [Select]

(setq ss (ssget '[b]([/b](0 . "LINE")(6 . "Continuous"))))

but shouldn't it echo back to you the selection set name?

rude dog

  • Guest
easy filter
« Reply #2 on: July 09, 2004, 09:20:40 PM »
sorry
this is what the code should look like:
Code: [Select]

(setq ss (ssget '((0 . "LINE")(6 . "Continuous"))))

but I still dont believe it is working properly cuz it does echo back the selection set name?....

rude dog

  • Guest
easy filter
« Reply #3 on: July 09, 2004, 10:20:39 PM »
but I still dont believe it is working properly cuz it does not echo back the selection set name?....or give me a sslength[/i][/b]

rude dog

  • Guest
easy filter
« Reply #4 on: July 09, 2004, 11:25:03 PM »
wow i have talked to myself long enuf to realize i have to omitt
the (6. "continuous") in the code....i guess the only other way is focus on a specific layer name....that sucks....is there any other way of doing it by
entity type: "line"     and         linetype: "continuous"  :?:
time for cerveza
lata

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
easy filter
« Reply #5 on: July 10, 2004, 12:38:06 AM »
Works for me..

Code: [Select]
_$ (setq ss (ssget "X" '((0 . "LINE") (6 . "Continuous"))))
<Selection set: 4>
_$


Maybe you should add the "X" 8)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rude dog

  • Guest
easy filter
« Reply #6 on: July 10, 2004, 12:49:15 AM »
that be it  :oops:

Anonymous

  • Guest
easy filter
« Reply #7 on: July 10, 2004, 01:06:12 AM »
man I dont know whats going on but I have two lines drawn that should make up the slecetion set and two that should not (only 4 lines drawn on the screen and nothing else)and this is what i get when i run the line of code:
Code: [Select]

Command: (setq ss (ssget "X" '((0 . "LINE") (6 . "Continuous"))))
nil



is there some magical value I need to change maybe.....

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
easy filter
« Reply #8 on: July 10, 2004, 01:11:50 AM »
After re-reading the first post, and the last post, I am confused....

The first post said that the selection set should be selected via crossong window, the "X" option selects all objects in the drawing....

The problem with your code is one that is easily overlooked by someone not familiar with the way entity data lists are written and stored. For ALL objects in the drawing there is a DXF code that applies for linetype, BUT that DXF code is optional and is not included on ANY objects set to BYLAYER. As such you cannot filter for that linetype on objects set to bylayer. This holds true for color AND linetype.

In order to effectively setup a filter for a linetype that is bylayer, would be to select al the objects and selectively remove them based on the DXF 6 codes and the layer setting.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

rude dog

  • Guest
easy filter
« Reply #9 on: July 10, 2004, 01:19:40 AM »
Quote
The first post said that the selection set should be selected via crossong window, the "X" option selects all objects in the drawing....


I did say this but then i realized it could not be done the i was approaching it
I will now have to filter with entity type "line" and probably a specific layer name.
that avatar is gunna give me nightmares 2nite <clicking the lights back on>

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
easy filter
« Reply #10 on: July 10, 2004, 10:26:09 AM »
rude dog
So sorry I misread your request last night. :oops:  I should have been getting some sleep
as well. Keith is quite right as usual. :)
i thought you were looking for lines with 'Continuous' and not ByLayer that were
'Continuous'. Here is a routine to do what Keith was enplaning, select lines that are
'Continuous' or, 'ByLayer' and the layer is set to 'Continuous'.

Again sorry if I lead you astray.

Thanks Keith for catching that and see if I missed anything in the routine that needs attention.

Code: [Select]
;;  User select lines, returns a selection set of LINES
;;  with 'Continuous Line Type' or ByLayer with a layer
;;  with 'Continuous Line Type'
;;  Returns nil if none are selected or 'Continuous Line Type'
;;  NOTE: this routine leaves objects selected if nil is not returned.
(defun Get:Cont:Lines (/ ss ssnew idx ent elst linetype lltype)
  ;;  Get user to pick lines
  (prompt "\nSelect lines to find 'Continuous Type'.")
  (if (setq ss (ssget '((0 . "LINE"))))
    (progn ; got some LINES
      (setq idx (sslength ss) ; how many lines
            ssnew   (ssadd)   ; empty selection set
      )
      (prompt (strcat "\n" (itoa idx) " LINE objects selected."))
      ;;  test every entity in the selection set
      (while (>= (setq idx (1- idx)) 0)
        (setq ent     (ssname ss idx) ; entity name
              elst    (entget ent) ; entity list
              linetyp (cdr (assoc 6 elst)) ; entity line type, may be nil
              ;;  if it is nil then the layer line type is used
              lltype  (cdr(assoc 6
                           (tblsearch "layer"
                             (cdr (assoc 8 elst))))) ; layer linetype
        )
        ;;  test if line entity has "Continuous" line type
        ;;
        ;;  (OR line entity has "ByLayer" line type
        ;;     AND layer is set to "Continuous" line type)
        (if (or (= linetyp "Continuous")
                (and (null linetyp) ; if ByLayer
                     (= lltype "Continuous")
                )
            )
          (ssadd ent ssnew) ; collect the lines
        ) ; endif
      ) ; while
      (prompt (strcat "\n" (itoa (sslength ssnew))
                      " were LINES that type \"Continuous\" .\n"))
      (if (= (sslength ssnew)0)
        nil ; return nil
        ;;  =====   ELSE  ======
        (progn
          (sssetfirst nil ssnew) ; display the selected items
          ssnew ; return a new selection set, note the set may be empty
        ) ; progn
      ) ; endif
    ) ; progn
    ;; ====  ELSE  =======
    (prompt "\nNothing Selected."); returns nil
  ) ;endif
); defun

(defun c:test(/ ss)
  (setq ss (Get:Cont:Lines))
  (cond
    ((null ss)
     (prompt "\nReturn was nil")
    )
    ((= (sslength ss) 0)
     (prompt "\nSelection set empty")
    )
    ( (prompt "\nGot Selection set."))
  )
  (getpoint "\nPress any key to exit.")
  (print)
  (command) ; clear the selected items
  (sssetfirst nil) ; clear the grips
  (princ)
) ;defun test
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rude dog

  • Guest
easy filter
« Reply #11 on: July 10, 2004, 11:48:11 AM »
cab works well dude.....I was thinking of doing something similar
this has laid down the blue print for me thanks for your time...... again  :)

SMadsen

  • Guest
easy filter
« Reply #12 on: July 10, 2004, 03:03:33 PM »
Quote from: Keith
As such you cannot filter for that linetype on objects set to bylayer.

While it's true that bylayer settings are not written to entity data lists, the SSGET filter mechanism does recognize "Bylayer" for linetypes and the number 256 for colors, meaning color "Bylayer".

(ssget "X" '((6 . "Bylayer")(62 . 256))) will return all objects with ltype and color as bylayer

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
easy filter
« Reply #13 on: July 10, 2004, 05:06:48 PM »
Very interesting, so you could use this to filter the selection set
the user picked to only lines with  Continuous or Bylayer.

Code: [Select]
(ssget '((0 . "LINE")(6 . "Continuous,Bylayer")))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

SMadsen

  • Guest
easy filter
« Reply #14 on: July 10, 2004, 05:20:12 PM »
If "Continuous" is the object linetype you're after, yes. Somehow I think the initial quest was to filter objects of linetype Bylayer where "Continuous" is the layer linetype. If so then it could be an idea to search the layer table and apply the layers that fit to the filter along with '(6 . "bylayer")