Jump to content

Select all lines except continuous type


Recommended Posts

teknomatika

Hi,

I need and thank you in advance for your help.

I need to select in a drawing  all types of lines except continuous.

I tried to use quick select  but the tool does not seem to distinguish between this style and the by layer.

 

Thanks!

Link to post
Share on other sites
teknomatika

 

Tharwat, thanks for the help.

It seems to work for the continuous type but not yet the continuous  defined as bylayer.

I wish that these too are included in the selection. 🙂

 

(defun c:notc (/ s)
(setq s (ssget '((0 . "*LINE") (6 . "~Continuous"))))
(command "_move" s)
);;or copyclip or copy;;
(princ)

 

Edited by teknomatika
code correction
Link to post
Share on other sites
teknomatika
9 minutes ago, Tharwat said:

Then you need to cycle through the layer table and make a list of the layer names that with the Line Type Continuous. ;) 

Try it yourself then let me know.

 

 

Tharwat, thanks.

But, as we say here, "this is too much sand for my truck" 🙂. I appreciate help to implement this part.

Link to post
Share on other sites
(defun c:notc (/ r l n s)
  (setq r "")
  (while (setq l (tblnext "LAYER" (null l)))
    (or (wcmatch (setq n (cdr (assoc 2 l))) "*|*")
        (and (= (cdr (assoc 6 l)) "Continuous")
             (setq r (strcat r n ","))
        )
    )
  )
  (if (setq s (ssget (list '(0 . "*LINE")
                           '(-4 . "<NOT")
                           '(-4 . "<OR")
                           (cons 8 r)
                           '(6 . "Continuous")
                           '(-4 . "OR>")
                           '(-4 . "NOT>")
                     )
              )
      )
      ;; do your stuff here. Move , copy ... etc as you indicated into your previous post
  )
  (princ)
)

 

Link to post
Share on other sites
teknomatika
1 hour ago, Tharwat said:

(defun c:notc (/ r l n s)
  (setq r "")
  (while (setq l (tblnext "LAYER" (null l)))
    (or (wcmatch (setq n (cdr (assoc 2 l))) "*|*")
        (and (= (cdr (assoc 6 l)) "Continuous")
             (setq r (strcat r n ","))
        )
    )
  )
  (if (setq s (ssget (list '(0 . "*LINE")
                           '(-4 . "<NOT")
                           '(-4 . "<OR")
                           (cons 8 r)
                           '(6 . "Continuous")
                           '(-4 . "OR>")
                           '(-4 . "NOT>")
                     )
              )
      )
      ;; do your stuff here. Move , copy ... etc as you indicated into your previous post
  )
  (princ)
)

 

 

 

Tharwat, tanks.

 Not work. What will I have done wrong?

 

(defun c:notc (/ r l n s)
  (setq r "")
  (while (setq l (tblnext "LAYER" (null l)))
    (or (wcmatch (setq n (cdr (assoc 2 l))) "*|*")
        (and (= (cdr (assoc 6 l)) "Continuous")
             (setq r (strcat r n ","))
        )
    )
  )
  (if (setq s (ssget (list '(0 . "*LINE")
                           '(-4 . "<NOT")
                           '(-4 . "<OR")
                           (cons 8 r)
                           '(6 . "Continuous")
                           '(-4 . "OR>")
                           '(-4 . "NOT>")
                     )
              )
      )
(command "_move" s);; do your stuff here. Move , copy ... etc as you indicated into your previous post
  )
  (princ)
)

 

Link to post
Share on other sites
teknomatika
27 minutes ago, Tharwat said:

 

Which part that is not working?  The move command or the selection set ?

 

From what I can see, the selection set.

 

Link to post
Share on other sites
1 hour ago, Tharwat said:

What's is your proposition ?

(defun c:notc (/ lst ss str)
  (setq str "")
  (while (setq lst (tblnext "LAYER" (null lst)))
    (if (= (cdr (assoc 6 lst)) "Continuous")
      (setq str (strcat str (cdr (assoc 2 lst)) ","))
    )
  )
  (if
    (setq ss
      (ssget
        (list
          '(0 . "*LINE")
          '(-4 . "<AND")
            '(-4 . "<NOT")
              '(-4 . "<AND")
                '(6 . "ByLayer")
                (cons 8 str)
              '(-4 . "AND>")
            '(-4 . "NOT>")
            '(6 . "~Continuous")
          '(-4 . "AND>")
        )
      )
    )
    (print (sslength ss))
  )
  (princ)
)

 

Link to post
Share on other sites
7 minutes ago, Tharwat said:

@Roy_043

I don't see any difference between yours and mine and I think excluding objects on the same layer with '(6 . "ByLayer ") does not make sense.

 

An object whose layer linetype is set to Continuous will only exhibit Continuous linetype if the object linetype property is either set to Continuous or ByLayer, hence, to select everything except objects with Continuous linetype, you need to exclude those with object linetype property set to Continuous, and those with object linetype property set to ByLayer and whose layer linetype is set to Continuous.

 

Your existing code will exclude objects residing on layers whose linetype is set to Continuous, but whose object linetype property may be set to something other than Continuous, therefore meaning that they should be included in the set.

 

I hope this clarifies things.

Edited by Lee Mac
Link to post
Share on other sites

 

6 minutes ago, Lee Mac said:

Your existing code will exclude objects residing on layers whose linetype is set to Continuous, but whose object linetype property may be set to something other than Continuous, therefore meaning that they should be included in the set.

 

Yes, and that's exactly what the OP wanted as you can see in below and as I got it that way.

 

6 hours ago, teknomatika said:

 

Tharwat, thanks for the help.

It seems to work for the continuous type but not yet the continuous  defined as bylayer.

I wish that these too are included in the selection. 🙂

 

 

 

Link to post
Share on other sites
37 minutes ago, Tharwat said:

I don't see any difference between yours and mine and I think excluding objects on the same layer with '(6 . "ByLayer ") does not make sense.

 

14 minutes ago, Tharwat said:

Yes Roy I know without doing any test.

 

You are not making much sense here.

Link to post
Share on other sites
teknomatika

Tharwat and Roy_043,

thanks!

 

For what I want, it works.

Effectively Selects all types of lines, except the type, continuous, even those defined as bylayer.
Thank you both for your interest and help.

Link to post
Share on other sites
  • 3 months later...
teknomatika

@ Tharwat and Roy_043


Olá.

Eu volto ao assunto.

A rotina tem sido muito útil, mas, por enquanto, acho que ela não filtra (exceto) as linhas definidas como "Por bloco". Na realidade, parece que estão incluídos na seleção, embora sejam do tipo "contínuo".

Quando apropriado, agradeço sua ajuda.

 

Obrigado!

Edited by teknomatika
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...