-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot open stp file in python #121
Comments
Never heard of stp. This is pygmsh, so it only reads gmsh's .geo files. If you need any other format, you'll have to get back to gmsh's developers. I don't think they'll implement a whole new format though. |
I suspect 'stp' is an MS-DOS-style three-letter suffix for STEP a three-dimensional CAD format described in ISO 10303. Gmsh can read STEP; the .geo command is
However, one can't do much with it after that beyond marking Physical Surfaces for boundary conditions, &c.; see ‘Can I edit STEP/IGES/BRep models?' in Gmsh's FAQ. Therefore, I don't think it's a very good fit for pygmsh, probably best left out; just use Gmsh directly. I have been thinking about STEP this week though for a couple of reasons: parsing and writing. Parsing:
I did have a go at this a little while ago as some STEP that I was handed, generated by SolidWorks, was so bad (topologically & geometrically: numerous distinct exactly coincident points, more nearly coincident points separated by picometres, lots of collinear and nearly collinear lines, &c.) that I had to parse it to clean it up before the Merge in Gmsh. Not having access to ISO 10303 or any other description of the format (anyone know of one?), I did study enough of the body of the files to work out how to extract points, lines, and circular arcs using pyparsing. It was quite laborious and only partially rewarding. I could share some of those learnings if of interest, but they're far from complete and not really industrially robust; I still had to manipulate the geometry interactively in the Gmsh GUI in most cases. Writing: The other thing that I was thinking was using the partial knowledge of the format gained above, making a sibling of One way to read and write STEP in Python is with FreeCAD, though I haven't been able to compile it for Python 3 as yet and the Python interface is not complete. Both Gmsh and FreeCAD use OpenCASCADE internally to deal with STEP and there are some Python interfaces to this which may be of use, though again, this would probably be quite separate from the concerns of pygmsh. (I haven't yet tried |
@gdmcbain |
No need for pygmsh then! Simply run
on the command line (possibly with some options) and you'll get a msh file. This you can read into Python with meshio. |
Yeah, I noticed that but my professor insists that I have to make mesh directly from the python with data in .stp (or now .geo file). So confused now... |
Yeah, me too. I don't get it. What does
mean? You already have the geometry, right? |
Thank you for your patience. My proffesor gave me this kind of task:
|
I see. The advantage of this approach would be that you can manipulate the geometry in pygmsh. The disadvantage: You'll have to translate the geometry given in the stp (or geo) file into Python (pygmsh) first. I've done this for a bunch of geo files before. -- In fact, that was the original motivation for writing pygmsh. Anyhow, there's no tool I know of that can help you with that. You'll need to look at the geo file and translate it manually. |
I am sorry , I did not understand - you translated that files manually? Good old "copy-paste and adaptation" method? :) Thank you very much for your time and answers |
Yes. |
Ok, have a nice day |
Hi, I have translated all geo file data except ruled surfaces. There is no command for adding ruled surface to geometry(at least in last editions). If I use geom.add_surface command it is not working(gmsh reports errors), but if I change manually "Surface" into "Ruled Surface" in geo file( after code execution) gmsh does not report any errors. However I am not allowed to do that. Do you have any advice?(If this should be another topic I will erase this and open a new one). |
You should first remove |
Ok, thank you. Happy new year :) |
Hi nschloe, could you please help in this regard. thankyou |
@SaimaSafdar Best always open a new issue for new problems. |
Dear pygmsh and python users, I have connected pygmsh, vtk files,paraview , python and gmsh. My question is how to connect .stp file with python. Inside of that file I have geometry which I have to use to create mesh. I do not know what all text in .stp file mean so I have not tried to read line by line from .stp file yet.
The text was updated successfully, but these errors were encountered: