JovanG Posted March 26, 2021 Posted March 26, 2021 Hey guys. I hope you're having a great day. Today I was trying to modify the attached lisp to select all blocks touching circles instead of *lines (like it works rigth now), but I didn't succeed. Can you help me please. What I'm trying to do is to create a lisp that helps me with this task: 1. Select all blocks called "Flow_direction" that touch a circle 2. Switch the selection to the other blocks called "Flow_direction" (those who don't touch any circle) I really appreciate your time and help, and if you can comment in the lisp where step 1 ends and start the other (for my understanding) I would be highly grateful. SBC.lsp Quote
ronjonp Posted March 26, 2021 Posted March 26, 2021 (edited) You should post a sample drawing too. Or change: ;;This: (setq plset (ssget '((0 . "*line")))) ;;to this: (setq plset (ssget '((0 . "CIRCLE")))) Edited March 26, 2021 by ronjonp Quote
JovanG Posted March 29, 2021 Author Posted March 29, 2021 (edited) On 3/26/2021 at 4:11 PM, ronjonp said: You should post a sample drawing too Of course @ronjonp here I upload my general database of pipe network, and a plane where I have to insert the correspondent "flow_direction" blocks (with paste to original coordinates). And for that´s that i want to use this program, to paste automatically all blocks from my general data base and select those who don´t touch any circle to delete them. On 3/26/2021 at 4:11 PM, ronjonp said: ;;to this: (setq plset (ssget '((0 . "CIRCLE")))) It didn´t works I don´t know why. Pipe_Network.dwg DWG-ALC-600.dwg Edited March 29, 2021 by JovanG Wrong attach Quote
ronjonp Posted March 29, 2021 Posted March 29, 2021 It mostly works on the Pipe_Network drawing. 1 Quote
JovanG Posted March 29, 2021 Author Posted March 29, 2021 4 minutes ago, ronjonp said: It mostly works on the Pipe_Network drawing. Oh! I thought that the program could identify all those blocks that touch any point of the circumference, including the one in the image because is touching it in two points. Thanks @ronjonp And do you know how to switch the selection to those blocks that didn't touch it? Quote
ronjonp Posted March 30, 2021 Posted March 30, 2021 What is supposed top happen in this scenario? That drawing is fairly inconsistent. Quote
JovanG Posted March 30, 2021 Author Posted March 30, 2021 1 hour ago, ronjonp said: What is supposed top happen in this scenario? That's weird, that is not supposed to be that way. In fact in mine is OK Quote
ronjonp Posted March 30, 2021 Posted March 30, 2021 34 minutes ago, JovanG said: That's weird, that is not supposed to be that way. In fact in mine is OK You're right .. I must have shifted them in your drawing after a test. Either way, what would the result be if there were an inconsistency like that? Quote
JovanG Posted March 30, 2021 Author Posted March 30, 2021 8 minutes ago, ronjonp said: what would the result be if there were an inconsistency like that? Sure the lisp program would delete it and I would realize it when print them all in PDF. What I haven´t achived yet is to switch the selection to the "flow_direction" blocks to delete them. Quote
ronjonp Posted March 30, 2021 Posted March 30, 2021 (edited) 11 minutes ago, JovanG said: Sure the lisp program would delete it and I would realize it when print them all in PDF. What I haven´t achived yet is to switch the selection to the "flow_direction" blocks to delete them. Try this .. it gives you a little bit of flexibility on the search distance to use. (defun c:sbp (/ d p s s2 x) ;; RJP » 2021-03-30 (cond ((and (setq d (getdist "\nPick a distance to search: ")) (setq s (ssget "_X" '((0 . "insert") (2 . "Flow_direction")))) (setq s2 (ssget "_X" '((0 . "circle")))) ) (setq s2 (mapcar 'cadr (ssnamex s2))) (foreach e (mapcar 'cadr (ssnamex s)) (setq p (cdr (assoc 10 (entget e)))) (if (vl-some '(lambda (x) (<= (distance p (vlax-curve-getclosestpointto x p)) d)) s2) (ssdel e s) ) ) (sssetfirst nil s) ) ) (princ) ) Edited March 30, 2021 by ronjonp 1 Quote
JovanG Posted March 30, 2021 Author Posted March 30, 2021 35 minutes ago, ronjonp said: Try this .. it gives you a little bit of flexibility on the search distance to use. Excelent @ronjonp! It makes all easier for me. Now i´ll finisht the code to be able to run it in my other drawings at once and print them. Thanks to you and to all the programmers that help us every day with our codes. I won't doubt in donate to such helpful site (I´ll leave the link here just in case, because it took me almost 1 hour to find it ) https://www.cadtutor.net/general/about.php The donation button is at the end of the page. I really really thank you all Quote
ronjonp Posted March 30, 2021 Posted March 30, 2021 2 minutes ago, JovanG said: Excelent @ronjonp! It makes all easier for me. Now i´ll finisht the code to be able to run it in my other drawings at once and print them. Thanks to you and to all the programmers that help us every day with our codes. I won't doubt in donate to such helpful site (I´ll leave the link here just in case, because it took me almost 1 hour to find it ) https://www.cadtutor.net/general/about.php The donation button is at the end of the page. I really really thank you all Glad to help! Quote
Recommended Posts
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.