Need help with finding overlapping lines with one polyline and selecting them

Need help with finding overlapping lines with one polyline and selecting them

rahul_jainMY6RE
Participant Participant
1,195 Views
10 Replies
Message 1 of 11

Need help with finding overlapping lines with one polyline and selecting them

rahul_jainMY6RE
Participant
Participant

can someone help in slecting the lines below my polyline. Basically, i have 1 polyline drawn exactly over several normal lines. now what do i want is that i select that polyline and with the help of lisp or command the lines which are directly below it gets selected. and my original polyline gets deleted. can anyone please help regarding this issue.

 

rahul_jainMY6RE_0-1716434203353.png

This is my initial drawing in which i need the shortest distance between 2 points and the path that it traverses

Now i used Spath for that and while it was more helpful than most. it drew a red polyline (as shown in pic below) from P1 to P2 which gave me distance.

rahul_jainMY6RE_1-1716434218578.png

Now what i want that instead of polyline the path that i have drawn (the path that is below the polyline and exactly coincides with it) get selected because in that i have given separate names to the lines and i need that data. 

 

So can u guys cook something up for this

@vladimir_michl 

@pendean 

@Kent1Cooper 

 

 

0 Likes
Accepted solutions (1)
1,196 Views
10 Replies
Replies (10)
Message 2 of 11

daniel_cadext
Advisor
Advisor

You can use the routine mentioned in your other thread, SPATH I think it was.

Anyway, get the vertexes from the generated polyline and use those in a fence selection set

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 3 of 11

rahul_jainMY6RE
Participant
Participant

Hi Daniel can u elaborate more on this, I am not much familiar with fence selectionset

0 Likes
Message 4 of 11

Sea-Haven
Mentor
Mentor

An example

 

 

 

(setq plent (entsel "\nPick pline "))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))
(setq co-ord (cons (last co-ord) co-ord)) ; close

(setq ss (ssget "F" co-ord '((0 . "*LINE"))))

 

 

0 Likes
Message 5 of 11

rahul_jainMY6RE
Participant
Participant

Can anyone actually write a lisp for me for this issue. because i've failing miserably at this.

0 Likes
Message 6 of 11

komondormrex
Mentor
Mentor
Accepted solution

check this out

 

(defun c:pick_under (/ target_pline target_pline_vertices target_pline_lines under_line_sset)
	(setq target_pline (car (entsel "\nPick target pline: "))
		  target_pline_vertices (mapcar 'cdr (vl-remove-if-not '(lambda (group) (= 10 (car group))) (entget target_pline)))
		  target_pline_lines (mapcar 'list target_pline_vertices (cdr target_pline_vertices)) 
		  under_line_sset (ssget "_f" target_pline_vertices '((0 . "line")))
	)
	(foreach line (vl-remove-if 'listp (mapcar 'cadr (ssnamex under_line_sset)))
		(if (not (vl-some '(lambda (pline_line) (and (or (equal (car pline_line) (mapcar '+ '(0 0) (cdr (assoc 10 (entget line)))) 1e-1)
														 (equal (cadr pline_line) (mapcar '+ '(0 0) (cdr (assoc 10 (entget line)))) 1e-1)
													 )
													 (or (equal (car pline_line) (mapcar '+ '(0 0) (cdr (assoc 11 (entget line)))) 1e-1)
														 (equal (cadr pline_line) (mapcar '+ '(0 0) (cdr (assoc 11 (entget line)))) 1e-1)
													 )
												)
						   )
						   target_pline_lines
				 )      
			)
			(ssdel line under_line_sset)
		)
	)
	(entdel target_pline) 
	(sssetfirst nil under_line_sset)
	(print)
)

 

updated

 

0 Likes
Message 7 of 11

rahul_jainMY6RE
Participant
Participant

Thanks bro u saved me

0 Likes
Message 8 of 11

rahul_jainMY6RE
Participant
Participant

hi komondormrex can you check this formula again it isn't working on some cases. like if i change P1 and P2 to other points.

rahul_jainMY6RE_0-1718351199512.png

 

then the lines it is selecting are not complete

rahul_jainMY6RE_1-1718351232104.png

 

can you please check where the problem is arising.

0 Likes
Message 9 of 11

komondormrex
Mentor
Mentor

hi,

check update with fuzz added.

0 Likes
Message 10 of 11

rahul_jainMY6RE
Participant
Participant
Hi can you please tell me what is fuzz factor. I'm not sure what it is
0 Likes
Message 11 of 11

komondormrex
Mentor
Mentor

when comparing two points the fuzz is a distance within which points are supposed to be equal.

komondormrex_0-1718354804724.png

 

0 Likes