GLAVCVS Posted February 2 Posted February 2 You might think that there is a drawback that, in concentric hatches, there will be more than 1 hatch perimeter containing the same buildings. SOLUTION: -sort the hatches in a list by area, from smallest to largest -start the selection sets from the smallest hatches. Make two sets for each hatch: one with the "F" filter to select the intersecting buildings and another with "WP" for the fully included ones. -if buildings already selected in previous sets appear, exclude those selected with "WP" in the previous set. As Lee Mac said, the objects to be treated must be completely visible on the screen. To do this, you can make a call to the zoom command at the beginning of the code Quote
Lucay Posted February 2 Author Posted February 2 Thank you for your quick response! On 2/2/2025 at 12:14 AM, GLAVCVS said: I think your approach should be the other way around: get the lists of points from the hatches and make selection sets of the building perimeters and their centroid texts. I'm sorry I'm quite new to lisp but I'm not sure I understand your suggestion. Would it be to select points rather than polylines? If that's the case, I don't see how you can use the points to obtain the texts associated with the buildings? And why would it be different from current method? And in relation to Lee's comment, do you think that's why some buildings (often the smaller ones) are not taken into account? I did the test previously and it didn't make any difference. Do you have an explanation as to why in "Test AUTOCAD 2" only a few buildings are selected, whereas all are hatched in blue? Quote
GLAVCVS Posted February 2 Posted February 2 I mean selecting the polylines of the buildings that are fully or partially within the different hatches. To identify the buildings (assuming they are made up of a single polyline) you can add a small code that creates a small extended data record, with an ordinal, on each polyline. This way you would no longer have to create a text label for each building. Quote
Lucay Posted February 2 Author Posted February 2 On 2/2/2025 at 10:48 AM, GLAVCVS said: To identify the buildings (assuming they are made up of a single polyline) you can add a small code that creates a small extended data record, with an ordinal, on each polyline. This way you would no longer have to create a text label for each building. I didn't know that you could create extended data record on polylines. Do you have any function names or documentation so that I can find out more? Thanks Quote
GLAVCVS Posted February 5 Posted February 5 Extended data can be added to any drawing object. Search on google or ask ChatGpt for a starting point Quote
BIGAL Posted February 5 Posted February 5 @Lucay Afralisp has some tutorials about using XDATA. https://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php Quote
Lucay Posted Saturday at 08:29 PM Author Posted Saturday at 08:29 PM On 2/5/2025 at 11:17 PM, BIGAL said: @Lucay Afralisp has some tutorials about using XDATA. https://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php Thanks, very useful. @GLAVCVS I have thought about your approach but as soon as I use circular hatches, you don't have many points for the hatch outline (I had only 2 points in addition to the center..) And I don't see why this approach would be any simpler than the one I was using initially (looping over all the candidate polylines and then looking at those that cross a coloured hatch seems quite natural), could you elaborate more or share a quick draft code please? Honestly I don't know how to solve my problem because even when I test simple cases (like the file I attached earlier ‘Test autocad 2’), the code can only return three polylines out of the 50 that should be. Test AUTOCAD 2.dwgFetching info... Quote
GLAVCVS Posted Sunday at 08:59 AM Posted Sunday at 08:59 AM (edited) Hello I've given you my opinion But if you already have a mental image of what your program should do to achieve its goal, perhaps you should explore it first. Every big problem becomes easier when it is divided into smaller problems. Since your program has some complexity and there doesn't seem to be anyone on this forum who has a tool already written that solves this job, let's do something: let's divide the task that your program must undertake into smaller tasks and solve each one of them. Maybe we can find more collaboration to solve specific tasks. The problem to solve: we have some objects of interest (buildings) whose context we want to determine Your approach: analyze each of the buildings and determine in what context they are My approach: analyze each context and determine what objects are inside. This afternoon (Spanish time) I will try to make a proposal for dividing tasks. All this, possibly, will serve as a roadmap for others who need to solve other complex problems Edited Sunday at 09:24 AM by GLAVCVS Quote
GLAVCVS Posted Sunday at 09:51 AM Posted Sunday at 09:51 AM Of course: any contribution, suggestion, correction or comment in this regard will be WELCOME. Quote
GLAVCVS Posted Sunday at 04:42 PM Posted Sunday at 04:42 PM Depending on your approach, the tasks could be: -select all buildings (selection set) -select all hatches that may contain buildings (another selection set) -since for each building you will have to check if it is contained in any of the hatches (in many cases you will have to check ALL hatches), you will have to create a list with the geometries of each hatch -once all of the above is done, analyze each building and check if its geometry is included in any of the hatch geometries. -if yes: perform the desired action (show a message, write to a file, perform some action on screen, etc.) According to my approach, the tasks could be: -select all hatches that may contain buildings (selection set) -analyze each hatch, get its perimeter and check which buildings are inside each one (using a selection set) -create a list with the buildings included in each hatch and finally display the results, export them in some way, etc. We can use this thread to develop the work plan you prefer. Or if you prefer, we can open a new one and develop the code collaboratively with the rest of the forum users who are interested in participating. It's up to you Quote
Lucay Posted Monday at 07:41 PM Author Posted Monday at 07:41 PM Thank you for your time @GLAVCVS, I'll create a new topic to have a title a bit more understandable. 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.