I just connected two points with a straight line in gmsh, but how can I undo it ?
2 Answers
GMSH is not a CAD tool that is very similar to other ones. It provides a GUI; however, not all actions can be done through it and even those that can be done, sometimes are much easier done using some coding.
GMSH stores all of your actions and data in GEO file format. Say, you added two points and a line between them using GUI. GMSH in the background would have created the following GEO file:
//+
Point(1) = {-0.1, 0.6, 0, 1.0};
//+
Point(2) = {-0.2, 1.5, 0, 1.0};
//+
Line(1) = {2, 1};
where //+
(comment syntaxis in GEO) separates individual actions.
- You can open this file (the one that you are currently working with inside GMSH) in your text editor via:
Modules -> Geometry -> Edit Script
. - Then, delete the last line that creates the line between the two points.
- Save the file in your text editor.
- Reload the file in GMSH using
Modules -> Geometry -> Reload Script
There is also a way to explicitly delete a line: Modules -> Geometry -> Delete
. Select the line you want to delete and press e
to complete deletion (follow the hints on top of the window). However, that's not formally an "UNDO". This is a "DO" to do the "UNDO".
While this looks inconvenient from the first glance (and I would agree with you, a devoted menu UNDO
button would be useful), GEO scripting language offers a lot of flexibility in creating the desired geometry. See the format description to familiarize yourself with it.
While my advice to shift towards doing more things using the GEO-file rather than the provided GUI is a little beyond the scope of the question, the struggle with the UNDO kind of highlights it.

- 2,266
- 14
- 34
- 55
-
1Wow ! Awesome answer ! You helped me a lot and saved me a lot of headaches! Great great answer ! :)) – Jun 28 '18 at 13:00