It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I started to use the XSection script recently and I am very impressed with the results (https://sourceforge.net/projects/xsectionklayout/).
The only problem I have is that if I specify a negative rounding radius and the deposited sturcture is smaller than twice this radius it will not show up at all in the final cross section. I looked through the source code of XSection.rbm and found this code segment, which probably is resposible:
Starting at line 475 (see arrows):
if taper
d = @ep.size_to_polygon(d, xyi, zi, 0, true, true)
elsif xyi <= 0
d = @ep.size_to_polygon(d, 0, zi, 2, true, true)
elsif mode == :round
# emulate "rounding" of corners by performing soft-edged sizes
d = @ep.size_to_polygon(d, xyi / 3, zi / 3, 1, true, true) <------------------
d = @ep.size_to_polygon(d, xyi / 3, zi / 3, 0, true, true) <------------------
d = @ep.size_to_polygon(d, xyi - 2 * (xyi / 3), zi - 2 * (zi / 3), 0, true, true) <------------------
elsif mode == :square
d = @ep.size_to_polygon(d, xyi, zi, 2, true, true)
elsif mode == :octagon
d = @ep.size_to_polygon(d, xyi, zi, 1, true, true)
end
I am not experienced with ruby so it is quite hard for me to add a correction.
Is there a way to either
Thanks for any help,
Luis
Comments
Hi Luis,
thanks for your feedback :-)
I am aware of the limitations you described. Unfortunately that is cannot be avoided with the approach that XSection pursues. The problem is that "growing" is basically just supported outward. Negative values for the radius means "soften" edges but that is implemented by first reducing the structure and then growing outwards. When the structure is too small it is reduced to "nothing" with the effect you observe.
An enhanced implementation which avoids this has to use a different approach. Like starting with a "hard" edge and then softening. For "softening" there basically is
Polygon#round_corners
, but I have not tried this approach myself.Matthias
Hello,
I finally was able to ensure that all structures are always visible. Now the requested rounding radius is decreased, so no structures vanish.
The following source code changes need to be made just before the code I quoted above:
Hope this helps others. Is there a way to upload the changed file to the forum?
Luis
Hi Luis,
the project on SourceForge is under SVN. You can send a patch and I will submit it.
Or it's time to move to GitHub with that project ...
Matthias
Hello,
I have adapted the above mentioned changes to the most recent version and created a pull request on GitHub:
https://github.com/klayoutmatthias/xsection/pull/7
Luis