Skip to content
Snippets Groups Projects
Commit 9b89d3d1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

this will be removed

parent bd46de3b
No related branches found
No related tags found
No related merge requests found
from gmshpy import *
GmshSetOption('General', 'Verbosity', 99.0)
GmshSetOption('Mesh', 'SaveAll', 1.0)
GmshSetOption('Mesh', 'Algorithm', 1.0)
g = GModel()
g.setFactory('Gmsh')
g.load("aneurysm.stl");
g.createTopologyFromMesh();
face = g.getFaceByTag(1);
newent = g.extrudeBoundaryLayer(face, 4, 0.5, 0, -1)
newent2 = g.extrudeBoundaryLayer(face, 4, -0.5, 1, -1)
print "*** face = %d " % face.tag()
print "*** new face = %d newface2 = %d " % (newent[0].tag(), newent2[0].tag())
g.mesh(2)
g.save("aneurysmBL.msh")
from gmshpy import *
GmshSetOption('Mesh', 'CharacteristicLengthFactor', 0.9)
R = 0.3;
myModel = GModel();
myModel.addSphere(0.5,0.5,0.5,R);
myModel.setAsCurrent();
myModel.mesh(2);
myModel.save("sphere.stl");
from gmshpy import *
lc = 0.5
GmshSetOption('Mesh', 'CharacteristicLengthFactor', lc)
g = GModel()
v1 = g.addVertex(0, 0, 0, lc)
v2 = g.addVertex(1, 0, 0, lc)
v3 = g.addVertex(1, 1, 0, lc)
v4 = g.addVertex(0, 1, 0, lc)
e1 = g.addLine(v2, v1)
e2 = g.addLine(v3, v2)
e3 = g.addLine(v4, v3)
e4 = g.addLine(v4, v1)
v11 = g.addVertex(.4, .4, 0, lc)
v12 = g.addVertex(.6, .4, 0, lc)
v13 = g.addVertex(.6, .5, 0, lc)
v14 = g.addVertex(.4, .6, 0, lc)
e11 = g.addLine(v11, v12)
e12 = g.addLine(v12, v13)
e13 = g.addLine(v13, v14)
e14 = g.addLine(v14, v11)
f = g.addPlanarFace ([[e1,e2,e3,e4],[e11,e12,e13,e14]])
g.mesh(2)
g.save("square1.msh")
#v100 = g.addVertex(0, 0, 0, .1)
#v200 = g.addVertex(0, 0, 1, .1)
#v300 = g.addVertex(0, .1, .33, .1)
#v400 = g.addVertex(.1, .1, .66, .1)
#line = g.addBezier(v100,v200,{{v300:x(),v300:y(),v300:z()},{v400:x(),v400:y(),v400:z()}});
#g.addPipe (f, {line})
#g.glue(1.e-9);
#myTool = GModel();
#myTool:addSphere(0.2,0.2,0.1,.52012);
#g.addSphere(1,1.3,1,.3);
#g.computeDifference(myTool,0);
#g.setAsCurrent();
#!/usr/bin/env python
from gmshpy import *
# from http://en.wikipedia.org/wiki/Constructive_solid_geometry
R = 1.4;
s = .7;
t = 1.25;
myModel = GModel();
myModel.addBlock([-R,-R,-R],[R,R,R]);
myTool = GModel();
myTool.addSphere(0,0,0,R*t);
myModel.computeBooleanIntersection(myTool);
myTool2 = GModel();
myTool2.addCylinder([-2*R,0,0],[2*R,0,0],R*s);
myTool3 = GModel();
myTool3.addCylinder([0,-2*R,0],[0,2*R,0],R*s);
myModel2 = GModel();
myModel2.addCylinder([0,0,-2*R],[0,0,2*R],R*s);
myModel2.computeBooleanUnion(myTool2);
myModel2.computeBooleanUnion(myTool3);
myModel.computeBooleanDifference(myModel2);
myModel2.setVisibility(0);
myModel.setAsCurrent();
myModel.setVisibility(1);
GmshSetOption("Mesh", "CharacteristicLengthFactor", 0.4);
#myModel.mesh(3);
#myModel.save("wikipedia.msh");
#myModel.save("wikipedia.brep");
FlGui.instance();
FlGui.run();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment