Jump to content

Select only lines


Ajmal

Recommended Posts

i need only select lines. But it's not coming.

(defun c:DE  ()
  (setq p1 (getpoint "\nSelect object..."))
  (setq p2 (getcorner p1))
  (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)))
  (setq p1 (list (nth 0 p1) (nth 1 p1)))
  (setq p2 (list (nth 0 p2) (nth 1 p2)))
  (setq lines (ssget "_C" p1 p2 ((list (cons "LINE")))))
  (if (/= (sslength lines) 4)
    (alert "4 lines need to be selected")))

 

Link to comment
Share on other sites

 

 

Quote

(defun c:DE (/ ss)
  (while (not (and (princ "\nSelect 4 LINEs...")
                   (setq ss (ssget (list (cons 0 "LINE"))))
                   (= (sslength ss) 4)
                   (princ "\n4 Line Selected..."))))
  (prin1))

 

 

While I don't now your exact input limitations, this could give much more flexibility.  -David

 

Link to comment
Share on other sites

If its 4 lines in some form touching like sq rectang diamond etc then try this idea if you pick a corner you make a little sq of 4 points then use ssget "F" with the 4 points it will find the two lines, repeat for other corner. I have used this method very successfully for all sorts of objects.

 

image.png.036b4903c12ad45f6642acc714a2e009.png

 

The other option is pick point inside make a bploy use these points to select objects at say midpoint along each line. I would go down this path as you can have more line segments.

 

image.png.4c5735370f57dad2c7bf673f744688ca.png

Edited by BIGAL
Link to comment
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
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...