Jump to content

Recommended Posts

Posted

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

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • Lucay

    14

  • GLAVCVS

    12

  • BIGAL

    3

  • SLW210

    2

Top Posters In This Topic

Posted Images

Posted

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?

Posted

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.

Posted
  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

Posted

Extended data can be added to any drawing object.
Search on google or ask ChatGpt for a starting point

Posted
  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...

 

Posted (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 by GLAVCVS
Posted

Of course: any contribution, suggestion, correction or comment in this regard will be WELCOME.

Posted

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

Posted

Thank you for your time @GLAVCVS, I'll create a new topic to have a title a bit more understandable.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...