A suggestion for a new FEM mesh GMsh icon

About the development of the FEM module/workbench.

Moderator: bernd

JellyPalm
Posts: 157
Joined: Sun Mar 29, 2020 12:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by JellyPalm »

jmaustpc wrote: Sat Jul 18, 2020 3:06 pm I generally don't like using letters in icons because they are then not translated for the non-English languages.
But surely if the Mesher is called Gmesh (for e.g.) that doesn't change whatever the language, so a G is acceptable here. I agree that generally icons are more universal but in this case it seems appropriate....and very obvious.

I look forward to more rubix with Kanji, cryllics, etc which would be cool too.

Personally, if there is only a couple of meshers then the current setup with the rubix cube on the toolbar is ok, but I think it would work on a drop-down menu too if there are more options - to reduce clutter.

An alternative Icon that might work for the generic Mesh drop-down menu could be a partial rubix with a 2 or 3 tiny cubes floating down to join it as though it was getting assembled....??

Image
FlyCube.svg
(41.36 KiB) Downloaded 57 times
Attachments
FlyCube.png
FlyCube.png (472.81 KiB) Viewed 1494 times
User avatar
Sudhanshu
Posts: 357
Joined: Mon Oct 15, 2018 5:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by Sudhanshu »

bernd wrote: Fri Jul 24, 2020 8:57 pm I am with you on the equations but not on the bcs.

Anyone volunteer to help with the implementation? It is C++ but very very easy to understand, even if one does not know C++. The task itself is smal to. I would help in going on track.
Looks interesting.
I am in for helping with the implementation. :)
Just need some direction.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A suggestion for a new FEM mesh GMsh icon

Post by bernd »

Sudhanshu wrote: Thu Jul 30, 2020 8:02 am I am in for helping with the implementation. :)
Just need some direction.
great, all the magic happens in this file: https://github.com/FreeCAD/FreeCAD/blob ... kbench.cpp

The idea is to make a drop down icon for the solver and for the mesher. There is no drop down in FEM implemented in Python, only in C++ This one here https://github.com/FreeCAD/FreeCAD/blob ... h.cpp#L207 is implemented here https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1524

The changes in menu structure changes for mesher and solver could be done directly in workbench.cpp. Just as it is done for materials and constraints inside menu Model. The drop down icon for tool bar for solver and mesher might be implemented in workbench.cpp as well.

You may have a look at the implementation of the other examples mentioned here ...
jmaustpc wrote: Tue Jul 21, 2020 2:28 pm For example have a look at
1) PartDesign additive or subtractive solids,
2) sketcher insert a circle from either Centre and point or 3 points on circumference
3) Sketch Radius constraint or Diameter Constraint

The icons can be exchanged later on.
User avatar
Sudhanshu
Posts: 357
Joined: Mon Oct 15, 2018 5:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by Sudhanshu »

bernd wrote: Thu Jul 30, 2020 11:14 am
Sudhanshu wrote: Thu Jul 30, 2020 8:02 am I am in for helping with the implementation. :)
Just need some direction.
great, all the magic happens in this file: https://github.com/FreeCAD/FreeCAD/blob ... kbench.cpp

The idea is to make a drop down icon for the solver and for the mesher. There is no drop down in FEM implemented in Python, only in C++ This one here https://github.com/FreeCAD/FreeCAD/blob ... h.cpp#L207 is implemented here https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1524

The changes in menu structure changes for mesher and solver could be done directly in workbench.cpp. Just as it is done for materials and constraints inside menu Model. The drop down icon for tool bar for solver and mesher might be implemented in workbench.cpp as well.
...
I had a look at the links.
Workbench.cpp code is simple to understand. But then you can't differentiate between a normal icon or a drop down icon in workbench.cpp.
The difference between the two comes from their way of declaration in the command.cpp file.
And I believe we create a a drop down icon by defining the command with

Code: Select all

DEF_STD_CMD_ACL
I also found the commented, old C++ code of the solver in command.cpp so I thought to take it as a starting point because I couldn't see how we can do the drop down implementation in workbench.cpp.
I uncommented a little of it in an attempt to only have a drop down icon in the tool bar without any function.
Which obviously failed during compilation with this error message :lol: :

Code: Select all

/usr/bin/ld: CMakeFiles/FemGui.dir/Command.cpp.o: in function `CmdFemCreateSolver::CmdFemCreateSolver()':
Command.cpp:(.text+0x2ba): undefined reference to `vtable for CmdFemCreateSolver'
collect2: error: ld returned 1 exit status
make[2]: *** [src/Mod/Fem/Gui/CMakeFiles/FemGui.dir/build.make:1760: Mod/Fem/FemGui.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:4596: src/Mod/Fem/Gui/CMakeFiles/FemGui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Should I commit the change so that I can share it here?
Or is an old commented code a bad starting point?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A suggestion for a new FEM mesh GMsh icon

Post by bernd »

We should do this much simpler.

Add a Group command here in module https://github.com/FreeCAD/FreeCAD/blob ... ommands.py This group command should be added in Workbench.cpp.

As an example have a look at the Arch Axis System. It has pull down tool with Axis, Axis System and Grid. All done in Python. See https://github.com/FreeCAD/FreeCAD/blob ... s.py#L1540

We might even could think to not add the new group command to the command.py but to a new module inside femcommands directory. I would call this module groupcommands.py
User avatar
Sudhanshu
Posts: 357
Joined: Mon Oct 15, 2018 5:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by Sudhanshu »

bernd wrote: Fri Jul 31, 2020 7:22 am We should do this much simpler.

Add a Group command here in module https://github.com/FreeCAD/FreeCAD/blob ... ommands.py This group command should be added in Workbench.cpp.

As an example have a look at the Arch Axis System. It has pull down tool with Axis, Axis System and Grid. All done in Python. See https://github.com/FreeCAD/FreeCAD/blob ... s.py#L1540

We might even could think to not add the new group command to the command.py but to a new module inside femcommands directory. I would call this module groupcommands.py
This was a much better way of implementation.
So here we go: https://github.com/Sudhanshu-Dubey14/Fr ... 648e4ca108

With these changes we are getting:
FEM_drop_icons.png
FEM_drop_icons.png (7.19 KiB) Viewed 1374 times

I am not able to click on the drop down and take a screenshot at the same time, but they are working.
And I haven't deleted the mesher icons yet because I don't know how to check if FreeCAD was built with Netgen or not in python.
There must be a variable or something for that about which I am not aware.
Once we are able to check for netgen and remove the icon accordingly, this should be good to go.

I have a few questions though:

1. Why are we not implementing netgen like gmsh or the solvers. If it's installed then just set the path. Why the "built with netgen" approach? Is it for compatibility, because FreeCAD used to come with netgen at some point in time?
2. Why is z88 in the menu item but not in the tool bar item?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A suggestion for a new FEM mesh GMsh icon

Post by bernd »

netgen is not used as a binary, it is used as library and FreeCAD is linked against this due to compile time. There is some variable to detect it, but I am on the way. Check command.cpp in Gui in Fem. There the netgen icon is grey if not compiled with netgen.


Z88 is not as icon because it its support is limited. In a drop down list we could add it anyway.
User avatar
Sudhanshu
Posts: 357
Joined: Mon Oct 15, 2018 5:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by Sudhanshu »

bernd wrote: Fri Jul 31, 2020 6:39 pm netgen is not used as a binary, it is used as library and FreeCAD is linked against this due to compile time. There is some variable to detect it, but I am on the way. Check command.cpp in Gui in Fem. There the netgen icon is grey if not compiled with netgen.
In Workbench.cpp, it is done like this:

Code: Select all

#ifdef FCWithNetgen
     *mesh
        << "FEM_MeshNetgenFromShape";
#endif
So netgen command is totally not there if it isn't compiled with netgen.

bernd wrote: Fri Jul 31, 2020 6:39 pm Z88 is not as icon because it its support is limited. In a drop down list we could add it anyway.
Oh, ok.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A suggestion for a new FEM mesh GMsh icon

Post by bernd »

exactly, no netgen icon if not compiled against netgen.
User avatar
Sudhanshu
Posts: 357
Joined: Mon Oct 15, 2018 5:22 am

Re: A suggestion for a new FEM mesh GMsh icon

Post by Sudhanshu »

bernd wrote: Fri Jul 31, 2020 7:10 pm exactly, no netgen icon if not compiled against netgen.
But I need to check for netgen in the groupcommands package, so I need that variable in python.
How do I get that? :?:
Post Reply