Skip to content
  • 这是gmsh文件(党徽.geo),有了上面的python代码,那简直太方便了,想生成什么格式就是什么格式

    //SetFactory("OpenCASCADE");
    lc=1;
    z1=0;
    z2=5;
    A=newp; Point(A) = {33.000000, 33.000000, z1, lc};
    B=newp; Point(B) = {1.000000, 33.000000, z1, lc};
    C=newp; Point(C) = {1.000000, 1.000000, z1, lc};
    D=newp; Point(D) = {33.000000, 1.000000, z1, lc};
    E=newp; Point(E) = {29.000000, 33.000000, z1, lc};
    F=newp; Point(F) = {33.000000, 29.000000, z1, lc};
    G=newp; Point(G) = {8.500000, 18.500000, z1, lc};
    H=newp; Point(H) = {19.500000, 7.500000, z1, lc};
    I=newp; Point(I) = {4.000000, 14.000000, z1, lc};
    J=newp; Point(J) = {17.000000, 5.000000, z1, lc};
    K=newp; Point(K) = {13.500000, 1.000000, z1, lc};
    M=newp; Point(M) = {17.000000, 17.000000, z1, lc};
    N=newp; Point(N) = {17.000000, 1.000000, z1, lc};
    R=newp; Point(R) = {11.000000, 16.500000, z1, lc};
    T=newp; Point(T) = {16.500000, 16.500000, z1, lc};
    V=newp; Point(V) = {16.500000, 11.000000, z1, lc};
    X=newp; Point(X) = {3.500000, 30.500000, z1, lc};
    Y=newp; Point(Y) = {6.000000, 30.000000, z1, lc};
    Z=newp; Point(Z) = {4.000000, 28.000000, z1, lc};
    L=newp; Point(L) = {11.923966, 6.076034, z1, lc};
    Q=newp; Point(Q) = {2.741283, 24.258717, z1, lc};
    S=newp; Point(S) = {27.620770, 16.500000, z1, lc};
    U=newp; Point(U) = {16.500000, 27.620770, z1, lc};
    W=newp; Point(W) = {4.500000, 22.500000, z1, lc};
    X1=newp; Point(X1) = {1.697224, 32.302776, z1, lc};
    Z2=newp; Point(Z2) = {4.730572, 27.269428, z1, lc};
    Y2=newp; Point(Y2) = {6.730572, 29.269428, z1, lc};
    E2=newp; Point(E2) = {11.500000, 15.500000, z1, lc};
    F2=newp; Point(F2) = {15.500000, 11.500000, z1, lc};
    E3=newp; Point(E3) = {22.104983, 26.104983, z1, lc};
    F3=newp; Point(F3) = {26.104983, 22.104983, z1, lc};
    E4=newp; Point(E4) = {26.135529, 30.135529, z1, lc};
    F4=newp; Point(F4) = {30.135529, 26.135529, z1, lc};
    // connection
    Circle(1)={N,M,F4};
    Line(2)={F4,F,E,E4};
    Circle(3)={E4,M,Y2};
    Line(4)={Y2,Y};
    Circle(5)={Y,X,X1};
    Circle(6)={X1,X,Z};
    Line(7)={Z,Z2};
    Circle(8)={Z2,M,Q};
    Line(9)={Q,W};
    Circle(10)={W,V,U};
    Circle(11)={U,T,E3};
    Line(12)={E3,E2,G,I,L};
    Circle(13)={L,K,J};
    Line(14)={J,H,F2,F3};
    Circle(15)={F3,T,S};
    Circle(16)={S,R,N};
    
    Curve Loop(1)={1:16};
    Plane Surface(1)={1};
    
    
    // Refine
    l() = Unique(Abs(Boundary{ Surface{1}; }));
    p() = Unique(Abs(Boundary{ Line{l()}; }));
    Characteristic Length{p()} = 0.1;
    
    Extrude {0, 0, z2-z1} {
        Surface{1}; 
      }
    
    Edited by Zhikui Guo
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment