Only one corner rounded

edited September 2017 in Python scripting
To round the corner of a polygon I could use .round_corners(inner radius, outer radius, number of points) and we use it quite a lot.
> round_corners(double rinner,double router,unsigned int n)
Is there a way to access only one corner to be rounded?
I'm facing the issue to round corner with a different value.


Thanks and Best Regards,
Andy

Comments

  • edited September 2017

    I don't know of a direct answer to your question, but I'll just point out something. This may already be obvious, but in case not --

    The same can be achieved with two (or more) overlapping shapes. Let's say you have a rectangle with three large radius and one small radius corner. Let's say the small radius corner is in the lower left. Then draw the rectangle and round all four corners at the large radius. Then draw a smaller rectangle with the same lower left coordinate but a different upper right coordinate (so it's a smaller rectangle). Then round all four corners of the smaller rectangle with the smaller corner radius.

    This works in most cases for most polygons you could imagine, but admittedly is not as convenient as accessing individual corners with .round_corners

    Another alternative is to make the code generate every point of a single polygon, so it looks just how you want.

  • edited November -1
    Hi David,
    Thanks a lot for your feedback.
    Right now that's what I'm doing.
    But as a next step I need to get the selected rect, get all corners and all points of the box and do some boolean operations.
    So before I continue I wonder to if there might be an easier way to round one corener or corner differently.
    (I also checked your TRT ..)

    Kind Regards,
    Andy
  • edited November -1

    Hi all,

    I don't know whether this is acceptable: you can basically inhibit corner rounding by introducing a small segment. Since collinear segments are merged, you need to create a small artificial corner.

    For example: this polygon:

    0.00000     0.00000
    0.00000     99.99900
    0.00100     100.00000
    100.00000   100.00000
    100.00000   0.00000
    

    has a small cut at the 0/100 corner. This cut will make this corner being ignored. So if you apply rounding to this polygon, the upper left corner is not touched.

    Kind regards,

    Matthias

    @David ... thanks for your help :-)

  • edited November -1
    Hello Matthias,
    Thanks for your feedback.
    I found now a proper working solution (thanks to the open pythin interface and interface and pya.region).
    I'll place a quadratic shape (with radius) in a circle of a given radius and subtract both Regions.
    In that case I'm able to specify each corner different and even inverse the rounding.
    It takes some more calculation but worked out in a proper way.

    Best Regards,
    Andy
Sign In or Register to comment.