rdp Posted March 1, 2017 Author Share Posted March 1, 2017 The layer creation and moving objects to it is really great, by the way Quote Link to comment Share on other sites More sharing options...
lrm Posted March 1, 2017 Share Posted March 1, 2017 I added a loop around the program to look at all text and then run the program for each text string. I think this may be what you want. Try version 2.0. I still have to address the minor bug of a text node being inline with a polyline vertex. To temporarily address this problem just move offending text slightly in the y direction. FindPoly-v2.0.lsp Quote Link to comment Share on other sites More sharing options...
rdp Posted March 2, 2017 Author Share Posted March 2, 2017 Hello Irm, IT WORKS! well, kind of, I'll explain with images. First of all, with too many polys it breaks, it says "too many intersections" (something along those lines, my autocad is not in english). So I have tested with around 200 polys. And then there is something going on with the zoom level. When I zoom to the extent of the drawing, this happens: If I zoom out a little, there are less of those lines, but it still doesn't work. I I zoom really far out, then it works (I have given each layer a color for clarification): It makes some mistakes depending on the zoom level (it assigns polys to wrong layers). But I find that at a zoom factor of 0.05 for my drawing, it is almost flawless. So a BIG thank you!. Even if its not perfect, it's going to save me a TON of work (probably wouldn't be able to do it without the script). I attached the sample in case that you want to test it some more, but really, this is great as it is, it makes me want to learn autolisp sample 5.dwg Quote Link to comment Share on other sites More sharing options...
lrm Posted March 2, 2017 Share Posted March 2, 2017 I am glad it works even if "kind of". I made a minor change that I think fixes the zoom level issue. Try out version 2.1. As I noted, the program draws a line from the text node to a point 10,000 units to the right and then counts the number of intersections with this line and every polyline in the drawing (not frozen). To select the line and find out its name I was selecting it at the text node. I wasn't happy with this method and as you discovered it is sensitive to the zoom scale. So instead of using the line command to create the long line I've made a change in v2.1 that creates the line directly in vlisp and therefore can get its name directly. This change seems to address the zoom level issue as the sensitivity of selecting at a point is a function of zoom. The 10,000 unit length line is a bit of a kludge. It restricts your drawings to being no larger than 10,000 units wide (measure from the text node). You can make this number larger by editing the line: (setq xp (list (+ 10000 (nth 0 txtnode)) ; point +x direction Those long horizontal lines are present in some of the pictures you posted are the temporary lines the program creates that did not get deleted (but should have). I could look into using the method BIGAL suggested for finding intersections but that would take me some time to implement. Let me know if version 2.1 is sufficient. ~Lee FindPoly-v2.1.lsp Quote Link to comment Share on other sites More sharing options...
rdp Posted March 2, 2017 Author Share Posted March 2, 2017 Now it's perfect! I've done already a very large area with the zoom out trick, in a little more than an hour, it would have taken me ages manually. Now using the fixed version Thanks again, I really appreciate your time. I wish I could return the favour. For someone with "limited lisp experience" I'd say this is really good! Quote Link to comment Share on other sites More sharing options...
lrm Posted March 2, 2017 Share Posted March 2, 2017 rdp, I'm glad it is working for you. It was much more fun for me than working on my taxes. When I first dabbled with AutoLISP I used a book to learn and a lot of trial and error. Now that we have google it makes getting answers to programming questions much easier. I've made one more tweak (v2.2) that turns off all the extraneous output. Enjoy! Lee FindPoly-v2.2.lsp Quote Link to comment Share on other sites More sharing options...
TARIK Posted February 23, 2020 Share Posted February 23, 2020 hi..this might be a very late respons but i think it helps there is an other easy way to do that by using mapinfo programme convert both text and polyline lyers then create a table in both of them update the collums then using the query you can give every pline a spesific color convert it back to Autocad then use Qselect done Quote Link to comment Share on other sites More sharing options...
yaakovavitalgmailcom Posted November 10, 2022 Share Posted November 10, 2022 Quote Can you sand this LSP for me? יכול לשייף לי את ה-LSP הזה? Quote Link to comment Share on other sites More sharing options...
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.