I need LISP to draw vertical and horizontal X lines from multiple points at once

I need LISP to draw vertical and horizontal X lines from multiple points at once

Anonymous
Not applicable
1,944 Views
2 Replies
Message 1 of 3

I need LISP to draw vertical and horizontal X lines from multiple points at once

Anonymous
Not applicable

hello,

 

i found it very time consuming drawing vertical and horizontal X-lines from multiple points.

could anyone help me with a lisp that can do that for me in few steps: like by selecting all the points at once not one by one?

 

0 Likes
Accepted solutions (2)
1,945 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution
(defun C:XYpoint (/ KK SS EG)
(setq KK 0)
(princ "\nSelect Points ? ")
(if (setq SS (ssget (list (cons 0 "POINT"))))
(progn
(while (< KK (sslength SS))
(setq EG (entget (ssname SS KK)))
(command "XLINE" "H" (cdr (assoc 10 EG)) "")
(command "XLINE" "V" (cdr (assoc 10 EG)) "")
(setq KK (1+ KK))
)
)
)
(princ)
)
Message 3 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

Another way, that doesn't involve getting out of the XLINE command and back in to change directions [and should therefore be detectably faster if you have a very large number of points]:

 

(defun C:XCTP (/ ss n); = Xline Crosses Through Points
  (prompt "\nTo draw horizontal and vertical Xlines through Points,")
  (if (setq ss (ssget '((0 . "POINT"))))
    (repeat (setq n (sslength ss))
      (command "_.xline"
        "_none" (cdr (assoc 10 (entget (ssname ss (setq n (1- n))))))
        "_none" "@1,0" "_none" "@0,1" ""
      )
    )
  )
  (princ)
)

 

That's for the World Coordinate System, but could be adjusted to work in a non-World UCS.  And of course, it assumes you're talking about Point entities, but it could be adjusted easily if your "points" are something like Blocks instead.

Kent Cooper, AIA