Problem with api "symmetrize" and OCC Kernel
Hi,
I´ve got a problem with the "symmetrize" function. I want to mirror a surface. While saving as "geo_unrolled" an error occurs: "Skipping surface 2 in export". There are also very much additional points in the mirrored geometry. It seems, that in the exported *.msh some points have different mesh sizes. While switching to the GEO kernel everything is all right. I´m using gmsh 4.4.1
regards, Martin
import sys
sys.path.append('/home/Werkzeuge/gmsh/4.4.1_2019-08-07/lib')
import gmsh
import numpy as np
model = gmsh.model
factory = model.occ
# factory = model.geo
gmsh.initialize(sys.argv)
gmsh.option.setNumber("General.Terminal", 1)
model.add("IL")
gmsh.option.setNumber("Mesh.Algorithm", 1); # 2d, 1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad
Q = 12 # Nutzahl
P = 10 # Polzahl
Da = 100 # Statoraußendurchmesser
Di = 55 # Statorinnendurchmesser
s = 3 # Nutschlitzbreite
ag = 1 # Luftspaltweite
bz = 7 # Zahnbreite
h1 = 1.5 # Zahnkopfhöhe 1
h2 = 2 # Zahnkopfhöhe 2
hj = 8 # Jochhöhe
hrs = 6 # Rückschlusshöhe
hm = 5 # Magnethöhe
ls = 150 # Paketlänge
def pd2c(r, phi):
x = r * np.cos(phi/180*np.pi)
y = r * np.sin(phi/180*np.pi)
return x, y
x = [0]*17
y = [0]*17
x[1],y[1] = pd2c(Da/2,0)
x[2],y[2] = pd2c(Da/2,180/Q)
x[3] = Di/2*np.cos(np.sinh(s/Di))
y[3] = s/2
x[4] = x[3]+h1
y[4] = s/2
x[5],y[5] = pd2c(Di/2,180/Q)
x[6] = Di/2+h1+h2;
y[6] = y[5]/x[5]*x[6]-bz/2/np.cos(np.pi/Di)
x[7] = Da/2-hj;
y[7] = y[5]/x[5]*x[7]-bz/2/np.cos(np.pi/Di)
x[8] = x[7]
x[9],y[9] = pd2c(np.sqrt(x[4]**2+y[4]**2),180/Q)
x[10] = (y[6]+x[5]/y[5]*x[6])/(y[5]/x[5]+x[5]/y[5])
y[10] = y[5]/x[5]*x[10]
x[11] = (y[7]+x[5]/y[5]*x[7])/(y[5]/x[5]+x[5]/y[5])
y[11] = y[5]/x[5]*x[11]
x[12] = Di/2
x[13] = x[4]
x[14] = Di/2-ag/3
x[15],y[15] = pd2c(Di/2-ag/3,180/Q)
lcar_s = 4
p = [0]
for k in range(1, 15+1):
p.append( factory.addPoint(x[k], y[k], 0, lcar_s))
p.append( factory.addPoint(0, 0, 0))
l1 = factory.addLine(p[8], p[1])
l2 = factory.addCircleArc(p[1], p[16], p[2])
l3 = factory.addLine(p[2], p[11])
l4 = factory.addLine(p[11], p[10])
l5 = factory.addLine(p[10], p[9])
l6 = factory.addLine(p[9], p[5])
l7 = factory.addCircleArc(p[5], p[16], p[3])
l8 = factory.addLine(p[3], p[4])
l9 = factory.addLine(p[4], p[6])
l10 = factory.addLine(p[6], p[7])
l11 = factory.addLine(p[7], p[8])
ll1 = factory.addCurveLoop([l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11])
s1 = []
s1.append((2,factory.addPlaneSurface([ll1])))
s1.append(factory.copy([s1[0]]))
factory.symmetrize([s1[-1]], -np.sin(np.pi/Q), np.cos(np.pi/Q) , 0, 0)
# factory.removeAllDuplicates()
factory.synchronize()
gmsh.option.setNumber("Mesh.MshFileVersion", 2.2)
model.mesh.generate(3)
gmsh.write("symmetrize2.msh")
gmsh.write("symmetrize2.geo_unrolled")