Autocad Lisp for selecting objects above the polylines(Open) & Lines (Considering them to be a fence selection).

Autocad Lisp for selecting objects above the polylines(Open) & Lines (Considering them to be a fence selection).

pankaj
Contributor Contributor
1,269 Views
8 Replies
Message 1 of 9

Autocad Lisp for selecting objects above the polylines(Open) & Lines (Considering them to be a fence selection).

pankaj
Contributor
Contributor

Hello Guys,
 I am trying to select multiple objects above the open polylines & lines.
To make it further i searched for Auto LISP code but i ended up in LISP for Crossing & window selection within a polyline and circle.
To make it automated please suggest me Auto LISP code for this.
Thanks in advance.
Regards Pankaj

0 Likes
Accepted solutions (1)
1,270 Views
8 Replies
Replies (8)
Message 2 of 9

Kent1Cooper
Consultant
Consultant

Post an image or sample drawing, showing the kind of relationship(s) involved.  In particular, is there a limit to how far above things should be selected?

Kent Cooper, AIA
0 Likes
Message 3 of 9

pankaj
Contributor
Contributor

Hello Kent Cooper,
Thanks for your reply.

 

  1. I have attached a Dwg file with my requirements.
    There are few objects placed above the Open polyline (case 1) and few objects placed above the Line (case 2)
    I need to select the objects above the open polyline & line by just selecting them in the attached dwg file.
  2. And I think the limit is within the length of the Polyline/ line in my requirement (Irrespective of any properties of the objects).
    Thanks in advance,
    Pankaj
0 Likes
Message 4 of 9

komondormrex
Mentor
Mentor
Accepted solution

hey,

check following

 

(defun c:fence_select (/ crossing_ename e_name)
	(setq crossing_ename (car (entsel "\n Pick crossing entity: ")))
	(cond
		(= "LWPOLYLINE" (setq e_name (cdr (assoc 0 (entget crossing_ename))))
			(setq fence_sset (ssget "_f" (mapcar 'cdr (vl-remove-if-not '(lambda (dxf_group) (= 10 (car dxf_group))) (entget crossing_ename)))))
		)
		(= "LINE" e_name
			(setq fence_sset (ssget "_f" (mapcar 'cdr (vl-remove-if-not '(lambda (dxf_group) (member (car dxf_group) '(10 11))) (entget crossing_ename)))))
		)
		(
			t
		)
	)
	(if fence_sset (sssetfirst nil (ssdel crossing_ename fence_sset)))
)

 

0 Likes
Message 5 of 9

Kent1Cooper
Consultant
Consultant

Ah....  A different meaning of "above" than I first assumed.

There are many routines out there for the searching that will find things crossed by Polylines or other objects with linearity.  The one iffiness about it all is the question of whether your Polylines might sometimes contain arc segments.  Most such routines use the Polyline vertices to make a Fence selection, but that will always use straight-line paths between vertices.  So if there are arc segments, such a selection could find objects that the Polyline does not actually cross, and/or miss objects that it does cross.

Kent Cooper, AIA
0 Likes
Message 6 of 9

pankaj
Contributor
Contributor

I totally understood the point you mentioned about the polyline with arc segments cannot fenced as arched fence.

Now shall i know "Is there a possibility of getting a lisp for object selection for objects above the straight polyline/ Line?"

 

0 Likes
Message 7 of 9

pankaj
Contributor
Contributor
Hello komondormrex,
Thanks for your Reply,
I have tired excuteing this LISP.
But i ended up in this folloing error mentioned below.
"Command: FENCE_SELECT
Pick crossing entity: ; error: too few arguments"

So is there any debugged version of your LISP code.|

Thanks in advance.
Pankaj.
0 Likes
Message 8 of 9

komondormrex
Mentor
Mentor

sorry, corrected @ #4

0 Likes
Message 9 of 9

pankaj
Contributor
Contributor

Thanks @komondormrex,
For sharing your excellent knowledge to me.
 
It was really helpful.

Regards,
Pankaj

0 Likes