Merging 2 Polygons

Hi All,

I have a question regarding a façade we are working on that has a sloping side. I have developed a simple example of what we are trying to achieve.

In the image below you can see that we have divided the façade up in a regular grid of panels but when it approaches the angled line some of the panels are becoming very small and slender.

What I would like to do is merger this small triangle highlighted in the image with the one beside it to make a larger panel.

It would be great if we could use a parameter to say if the bottom edge of the panel was below a certain size it would automatically merge with the one next to it but I might be asking too much there.

I have also attached the scrip file for this example (Connect version)

Thanks

Wayne

GC_Facade_Combine.zip

Parents
  • Hi Wayne,

    The reference file containing the line elements was not included in the ZIP archive.  Could you please send it?  It's OK to send both files as DGNs (may need to be a ZIP-archive), because then we avoid any measurement unit mismatches. 

    Of course, it is possible to achieve what you propose.  One way of implementing such algorithm would be to iterate through all polygons in the façade, skip any polygons that meet the "too small" criteria (whatever they are), for large enough ones combine them with any neighboring polygons that are too small, and collect them as the new façade.  If the façade has a sharp tip, then the algorithm may need to change to ensure that any neighboring two "too small" façade panels are collected into the triangular tip. 

    HTH,

         Volker

       

  • Hi Volker,

    Sorry should have thought the lines wouldn't be included in the file.

    I have attached the DGN file.

    Sounds like you are right onto the solution.

    The project we are working on doesn't have a sharp tip so that shouldn't be an issue it is more down the sides that small panels need to be combined at this stage.

    Thanks

    Wayne

    1261.GC_Facade_Combine_dgn.zip

  • Hi Wayne,

    Finally caught up with this one:

    Attached is the DGN with the lines and the polygons collected so that polygons smaller than some "limitArea" as set by "slider1" are combined into larger panels. 

    polygon2.ByFunction follows the algorithm outlined above and further detailed here:

    it iterates through the rows of the initial Polygon.ByPointGrid

    for each polygon in a row, it checks whether the current polygon is valid by checking that the Area is greater than zero (this would usually be done by checking the property Success; however, Success appears to be set incorrectly at this point in time)

    if the previous polygon existed and was valid and smaller than the limitArea ("too small") then it will be combined with the current polygon by picking up its leading edge vertices

    if the next polygon exists, is valid, and "too small", then it will be combined with the current polygon by picking up its trailing edge vertices

    this completes the polygon that needs to be collected for the new polygon grid without polygons that are "too small".

    Again, there may be additional checks necessary to avoid failure in some additional cases. 

    Please let me know whether the resulting script function makes sense.

    HTH,

          Volker

    GC_Facade_Combine_Suggestion.zip

       

    Answer Verified By: Wayne Dickerson 

  • Amazing.

    I need to work through the example and see how it works. I may ask some question if I get stuck if that is ok.

    I am sure this could be a stepping stone to understanding functions and analyzing data arrays.

    Thanks again

    Wayne

Reply Children
No Data