<html><head></head><body><div class="ydp9534c023yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
        <div dir="ltr" data-setdir="false">Good morning Christophe,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">it's quite a complex behavior but indeed it works.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks for the explanation,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Marco</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
        
        </div><div id="ydp2511c8d7yahoo_quoted_8946471260" class="ydp2511c8d7yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    Il lunedì 24 agosto 2020, 09:35:26 CEST, Christophe Geuzaine <cgeuzaine@uliege.be> ha scritto:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr"><br clear="none"><br clear="none">> On 23 Aug 2020, at 21:40, Marco Antolovic <<a shape="rect" href="mailto:marco_antolovic@yahoo.it" rel="nofollow" target="_blank">marco_antolovic@yahoo.it</a>> wrote:<br clear="none">> <br clear="none">> Hi all,<br clear="none">> <br clear="none">> while I was building a geometry I came across an unexpected behavior of the BooleanUnion operator.<br clear="none">> <br clear="none">> I assumed that the operator would work on surfaces but it does not. If you try the example below, the union result is going to be two separate surfaces<br clear="none">> <br clear="none">> SetFactory("OpenCASCADE");<br clear="none">> <br clear="none">> recta1=newreg;<br clear="none">> Rectangle ( recta1 ) = { -.02, -.030, 0, .005, 0.01};<br clear="none">> recta2=newreg;<br clear="none">> Rectangle ( recta2 ) = { -.015,   -.020, 0, .005, -0.01 };<br clear="none">> <br clear="none">> resulting_surface() = BooleanUnion{ Surface{recta1}; Delete;}{ Surface{recta2}; Delete;};<br clear="none">> <br clear="none">> For i In {0: #resulting_surface()-1}<br clear="none">> Printf ("test openCASCADE surface union = %g", resulting_surface(i));<br clear="none">> EndFor<br clear="none">> <br clear="none">> The example shows that resulting_surface() contains two elements instead of one.<br clear="none">> <br clear="none">> Does BooleanUnion works on surfaces?<br clear="none"><br clear="none">It does actually work as expected: the 2 surfaces are glued by the union operation (by curve 2); but indeed OpenCASCADE leaves the internal curve in the final geometry.<br clear="none"><br clear="none">Recent versions of Gmsh introduced the "Geometry.OCCUnionUnify" option to try to remove internal seams when the two surfaces are on the same geometry. In your case you should define the two surfaces in the same plane (the second is reversed, i.e. you should define Rectangle ( recta2 ) = { -.015,   -.030, 0, .005, 0.01 };), and we will generate a new surface without internal curve.<br clear="none"><br clear="none">Also note that you might want to se "Geometry.OCCBooleanPreserveNumbering = 0;" in this case. Because since the actual union operation keeps the two surfaces, the "Delete" operation would not be taken into account.<br clear="none"><br clear="none">So, long story short:<br clear="none"><br clear="none">SetFactory("OpenCASCADE");<br clear="none">recta1=newreg;<br clear="none">Rectangle ( recta1 ) = { -.02, -.030, 0, .005, 0.01};<br clear="none">recta2=newreg;<br clear="none">Rectangle ( recta2 ) = { -.015,   -.030, 0, .005, 0.01 };<br clear="none">Geometry.OCCUnionUnify = 1;<br clear="none">Geometry.OCCBooleanPreserveNumbering = 0;<br clear="none">resulting_surface() = BooleanUnion{ Surface{recta1}; Delete;}{ Surface{recta2}; Delete;};<br clear="none"><br clear="none">Christophe<div class="ydp2511c8d7yqt6009190374" id="ydp2511c8d7yqtfd66738"><br clear="none"><br clear="none"><br clear="none"><br clear="none">> <br clear="none">> Many thanks,<br clear="none">> <br clear="none">> Marco</div><br clear="none">> _______________________________________________<br clear="none">> gmsh mailing list<br clear="none">> <a shape="rect" href="mailto:gmsh@onelab.info" rel="nofollow" target="_blank">gmsh@onelab.info</a><br clear="none">> <a shape="rect" href="http://onelab.info/mailman/listinfo/gmsh" rel="nofollow" target="_blank">http://onelab.info/mailman/listinfo/gmsh</a><br clear="none"><br clear="none">— <br clear="none">Prof. Christophe Geuzaine<br clear="none">University of Liege, Electrical Engineering and Computer Science <br clear="none"><a shape="rect" href="http://www.montefiore.ulg.ac.be/~geuzaine" rel="nofollow" target="_blank">http://www.montefiore.ulg.ac.be/~geuzaine</a><div class="ydp2511c8d7yqt6009190374" id="ydp2511c8d7yqtfd63400"><br clear="none"><br clear="none"><br clear="none"></div></div></div>
            </div>
        </div></body></html>