Saving geometry bug

I’m creating a geometry using the following code:

[code]sph1 = occ.Sphere(occ.Pnt(0.5,0.5,0.5), r=0.5)
cyl0 .Cylinder(occ.Pnt(0.5,0.5,0.5), occ.X, r=0.1, h=0.1)
cyl2 = occ.Cylinder(occ.Pnt(0.7,0.5,0.5), occ.X, r=0.1, h=0.1)
cyl3 = occ.C= occ.Cylinder(occ.Pnt(0.5,0.5,0.5), occ.X, r=0.1, h=1)
cyl1 = occylinder(occ.Pnt(0.9,0.5,0.5), occ.X, r=0.1, h=0.1)
sph = occ.Sphere(occ.Pnt(0.5,0.5,0.5), r=0.1)
cyl= cyl0+cyl1+cyl2+cyl3+sph
geo = sph1 - cyl

geo.WriteStep(“Geometry.step”)[/code]

It is basically a sphere with a hole, but when I reloaded the geometry in Ngsolve using a step file, the geometry was a cylinder that is cyl in the code.
Note: when I change the sphere by the box. The saved geometry is correct. So I thought that it’s a bug when saving with a sphere,

Hi,
reported as a bug to the opencascade devs here:

Best
Christopher

Update: It seems to be a bug in occ that happens if the cylinder is exactly this way with the (for paramametrization needed) sphere edge.
As a workaround you can rotate the sphere:

``````import netgen.occ as occ
from netgen.webgui import Draw as DrawGeo

sph = occ.Sphere(occ.Pnt(0,0,0), r=0.5).Rotate(occ.Axis((0,0,0), (0,1,0)), 90)
cyl = occ.Cylinder(occ.Pnt(0,0,0), occ.X, r=0.1, h=1)
geo = sph - cyl

geo.WriteStep("Geometry.step")``````

Hi Christopher,