Jump to content
teknomatika

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!

Share this post


Link to post
Share on other sites
Tharwat
(setq s (ssget '((0 . "*LINE") (6 . "~Continuous"))))

 

Edited by Tharwat
  • Like 1

Share this post


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

Share this post


Link to post
Share on other sites
Tharwat

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.

Share this post


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.

Share this post


Link to post
Share on other sites
Tharwat
(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)
)

 

Share this post


Link to post
Share on other sites
Roy_043

@Tharwat

That is not going to work properly. Objects on 'Continuous' layers may have a 'non-Continuous' linetype.

Share this post


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)
)

 

Share this post


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

@Tharwat

That is not going to work properly. Objects on 'Continuous' layers may have a 'non-Continuous' linetype.

What's is your proposition ?

Share this post


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

Tharwat, tanks.

 Not work. What will I have done wrong?

 

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

Share this post


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.

 

Share this post


Link to post
Share on other sites
Roy_043
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)
)

 

Share this post


Link to post
Share on other sites
Tharwat

@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.

 

@teknomatika

Please upload a copy of the drawing you tested the codes on if you can and not any other drawing ?

Share this post


Link to post
Share on other sites
Lee Mac
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

Share this post


Link to post
Share on other sites
Tharwat

 

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. 🙂

 

 

 

Share this post


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

 

@Tharwat

Test your code with the attached file.Linetype_test.dwg

Yes Roy I know without doing any test, let's wait for the OP and see if they meant that or it was unnecessarily but anyway, the goal is vague somehow and excepts the two ideas of the codes.

Share this post


Link to post
Share on other sites
Roy_043
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.

Share this post


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.

Share this post


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.   Paste as plain text instead

  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...