Jump to content

Recommended Posts

Posted

hi

i need select similar LISP for ((horizontal line,polyline or vertical line,polyline).plz find example attachment.

I appreciate quick response

venki

SELECT SIMILAR (FILTER).JPG

Posted

Here is my version to select Vertical or horizontal Lines / polylines according to user' s choose .

 

(defun c:Test (/ sel ss go)
 (vl-load-com)
;;;;  *******        Tharwat 14. June . 2012     ******* ;;;;;;
;;;;  This peice of code to select Horizontal or Vertical ;;;;;
;;;;  lines or Polylines according to user's choose       ;;;;;
 (defun Catch (ang1 ang2 ss)
   ((lambda (l / i n sn e x p1 p2)
      (while (setq sn (ssname ss (setq l (1+ l))))
        (setq e (entget sn))
        (if (wcmatch (cdr (assoc 0 (entget sn))) "*POLYLINE")
          (progn
            (setq i 0
                  n 0
            )
            (repeat (setq x (fix (vlax-curve-getendparam sn)))
              (if
                (or
                  (equal
                    (angle (setq p1 (vlax-curve-getpointatparam sn i))
                           (setq p2 (vlax-curve-getpointatparam
                                      sn
                                      (setq i (1+ i))
                                    )
                           )
                    )
                    ang1
                  )
                  (equal (angle p1 p2) ang2)
                )
                 (setq n (1+ n))
              )
            )
            (if (eq n x)
              (ssadd sn sel)
            )
          )
          (if
            (or (eq (angle (cdr (assoc 10 e)) (cdr (assoc 11 e))) ang1)
                (eq (angle (cdr (assoc 10 e)) (cdr (assoc 11 e))) ang2)
            )
             (ssadd sn sel)
          )
        )
      )
    )
     -1
   )
   (princ)
 )
 (if
   (and (setq sel (ssadd))
        (progn
          (initget "Horizontal Vertical")
          (setq go (getkword "\n Choose one [Horizonta/Vertical] :"))
        )
        (setq ss (ssget "_:L" '((0 . "*POLYLINE,LINE"))))
   )
    (if (eq go "Horizontal")
      (Catch 0.0 pi ss)
      (Catch (/ pi 2.) (* pi 1.5) ss)
    )
 )
 (if (> (sslength sel) 0)
   (sssetfirst nil sel)
 )
 (princ)
)

Posted

Perhaps I am missing something... Given the sample screenshot posted above, why will SELECTSIMILAR Command not work? :unsure:

Posted
Perhaps I am missing something... Given the sample screenshot posted above, why will SELECTSIMILAR Command not work? :unsure:

 

Firstly the OP using cad 2006 which the new command is not available before cad 2012 ,

and the second issue is that the Angle option is not available into that new command call .;)

Posted
Firstly the OP using cad 2006 which the new command is not available before cad 2012 ,

and the second issue is that the Angle option is not available into that new command call .;)

 

Tharwat, the SELECTSIMILAR Command has been around since +/-2006; I used it with Land Desktop (LDD) 2006... Admittedly, LDD had functionality that Vanilla does not.

 

Secondly, you're presuming that the lack of a vertical, or horizontal selection option is a flaw in the design of the command, when in fact it serves a greater purpose... To make it incumbent upon the user to adhere to 'good' drafting practices, in which case this selection option is not necessary (IMHO)... Instead, one can rely upon other LAY* Commands to accomplish their goal.

 

:thumbsup:

Posted

Thanks a LOT spending time for me;great works

 

venki

 

 

 

Here is my version to select Vertical or horizontal Lines / polylines according to user' s choose .

 

(defun c:Test (/ sel ss go)
 (vl-load-com)
;;;;  *******        Tharwat 14. June . 2012     ******* ;;;;;;
;;;;  This peice of code to select Horizontal or Vertical ;;;;;
;;;;  lines or Polylines according to user's choose       ;;;;;
 (defun Catch (ang1 ang2 ss)
   ((lambda (l / i n sn e x p1 p2)
      (while (setq sn (ssname ss (setq l (1+ l))))
        (setq e (entget sn))
        (if (wcmatch (cdr (assoc 0 (entget sn))) "*POLYLINE")
          (progn
            (setq i 0
                  n 0
            )
            (repeat (setq x (fix (vlax-curve-getendparam sn)))
              (if
                (or
                  (equal
                    (angle (setq p1 (vlax-curve-getpointatparam sn i))
                           (setq p2 (vlax-curve-getpointatparam
                                      sn
                                      (setq i (1+ i))
                                    )
                           )
                    )
                    ang1
                  )
                  (equal (angle p1 p2) ang2)
                )
                 (setq n (1+ n))
              )
            )
            (if (eq n x)
              (ssadd sn sel)
            )
          )
          (if
            (or (eq (angle (cdr (assoc 10 e)) (cdr (assoc 11 e))) ang1)
                (eq (angle (cdr (assoc 10 e)) (cdr (assoc 11 e))) ang2)
            )
             (ssadd sn sel)
          )
        )
      )
    )
     -1
   )
   (princ)
 )
 (if
   (and (setq sel (ssadd))
        (progn
          (initget "Horizontal Vertical")
          (setq go (getkword "\n Choose one [Horizonta/Vertical] :"))
        )
        (setq ss (ssget "_:L" '((0 . "*POLYLINE,LINE"))))
   )
    (if (eq go "Horizontal")
      (Catch 0.0 pi ss)
      (Catch (/ pi 2.) (* pi 1.5) ss)
    )
 )
 (if (> (sslength sel) 0)
   (sssetfirst nil sel)
 )
 (princ)
)

Posted
Thanks a LOT spending time for me;great works

 

venki

 

 

Happy to hear that . :)

 

You're welcome .

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...