The code runs just fine but the step file is not properly defined. When importing into other CAD programs it throws errors or appears as a solid tube in SolidWorks.
One more follow-up, the gmsh_api seems to have different behavior than gmsh package installed via pip install.
The example script successfully generates a solid with the gmsh_api but fails with the pip package.
That works! Thank you.
A couple of follow-up questions:
Apologies, attached is a full test script. test.py
I've looked over the tutorials and searched issues here while trying to convert my .geo script to the API. Apologies if this is the wrong place, but this seems to have replaced the mailing list?
As outlined in the title, my goal is to create a spline from a list of points, revolve it around a centerline, and save the resulting solid geometry (in the GUI I had issues saving as brep, only step working for me. My script is below, right now it is running into an error with the definition of line1 using a list of the known length. I tried using getEntities
instead and could not figure it out.
gmsh.initialize()
for idx,pt in enumerate(pts):
if idx == 0:
firstPt = gmsh.model.occ.addPoint(pt[0],pt[1],pt[2], h)
if idx == numPts-1:
lastPt = gmsh.model.occ.addPoint(pt[0],pt[1],pt[2], h)
gmsh.model.occ.addPoint(pt[0],pt[1],pt[2], h)
line1 = gmsh.model.occ.addSpline([np.arange(1,numPts+1)])
firstCoord = pts[0,:]
lastCoord = pts[-1,:]
endPt = gmsh.model.occ.addPoint(lastCoord[0],0,0, h)
startPt = gmsh.model.occ.addPoint(0,0,0, h)
line2 = gmsh.model.occ.addLine(lastPt,endPt)
line3 = gmsh.model.occ.addLine(startPt,firstPt)
rev = gmsh.model.occ.revolve(gmsh.model.getEntities(1), 1,0,0, 0,0,0, 2*np.pi )
b = [s[1] for s in rev]
surfLoop = gmsh.model.occ.addSurfaceLoop(b)
vol = gmsh.model.occ.addVolume([surfLoop])
gmsh.model.occ.synchronize()
gmsh.write(savePath)
gmsh.finalize()