Foxelmanian / ToOptixUpdate

Current development of tooptix
20 stars 7 forks source link

Different code trees with nearly the same files #4

Closed joha2 closed 5 years ago

joha2 commented 5 years ago

Sorry for flooding you with issues, but maybe it improves usability:

I observed that in either ToOptix_* folder nearly the same files resist, in particular about the optimization. Maybe it is possible to separate the core code from the implementation for Python, Blender, FreeCAD.

I would suggest to have a structure like this:

ToOptixCore - optimization and absolute necessary infrastructure
ToOptixFreeCAD - uses ToOptixCore and implements FreeCAD macro
ToOptixBlender - uses ToOptixCore and implements Blender macro
ToOptixPython - uses ToOptixCore and implements Python API

From this you have to manage only ONE core code and not three.

Hope this helps, Johannes

Foxelmanian commented 5 years ago

Hi @joha2 not I am glad for that your right. I jusst added as fast as possible some AddOns. For the development i have only on Code Basis.

I want restructure the project aswell.

I think i will create 3 different repos. One with the core functions. And the other two with the GUI.

Best regards

Martin

joha2 commented 5 years ago

Thanks again for your fast response, that's really nice! :-) I just want to ask: It is necessary to create three different repos? Just as an example: As you already know, on the FreeCAD forum there are lots of people who are eager to use topology optimization ready to use. For them it would be nice to put all this stuff into one repo which works out of the box. It is maybe too complicated to tell them: "Well, download ToOptixFreeCAD repo and ToOptixCore repo and then make them speak to each other with some complicated mechanism". The proposed change in my other post has the advantage to just manage one package with different front ends. I could also help with the implementation. I am interested in your optimization approach anyway, and therefore it would be a good opportunity to study the code, if you wish :-)

Best wishes Johannes

joha2 commented 5 years ago

TL;DR I think you actual approach on the code is very good, but the code doubling has to be mitigated by redirecting some of the imports and making an extra dir for the core code which is separated anyway in your front end directories. So it shouldn't be too complicated, to do this.

Foxelmanian commented 5 years ago

Hi @joha2 you can use submodules in github. So you only reference external repositories.

If you download the repo, you the Addon repository and the referenced will be downloaded automatically. So the user dont need to do anything.

https://github.com/DMST1990/ToOptixCore https://github.com/DMST1990/ToOptixBlenderAddon https://github.com/DMST1990/ToOptixFreeCADAddon

So if I change the core funcitonalyt of the BlenderAddon we can automatically update the other aswell.

joha2 commented 5 years ago

Hey @DMST1990! Yeah, i know sub modules functionality. It solves the primary issue I have with the code tree, but there are two things to consider:

At the end of the day in the current developement stage the split up is maybe the best option. Just tell me, where I can contribute for future collaboration :-)

Best wishes Johannes

Foxelmanian commented 5 years ago

Hi @joha2 , well it depends on what you want to improve/contribute. I will delte the ToOptixUpdate and ToOptix repo in the future. So there will be only one "Core" repro and several GUI.

For further development you can contribute to the UI´s

https://github.com/DMST1990/ToOptixBlenderAddon https://github.com/DMST1990/ToOptixFreeCADAddon

or the Optimizaiton Model itself. https://github.com/DMST1990/ToOptixCore

I will extend in the near future the "core" for Multi-Material and Multi-Objective optimization. Then you can just combine several Load-Cases and Materials.

Best wishes

Martin

Foxelmanian commented 5 years ago

Hi @joha2 , do you have any wishes? What should be included next?

Best wishes

Martin

joha2 commented 5 years ago

First of all, it would be nice to have a generic Python interface to your optimizer, together with an easy to use interface. In the second step, I would like to have a FreeCAD workbench instead of a macro. But with this, I can assist you, if you wish. :-)

Foxelmanian commented 5 years ago

@joha2 allright, then I will build a generic interface for that. I have no clue how to set up a Workbench on that, so that would be a huge help. In Addition I am not quite good on programming Front Ends.

joha2 commented 5 years ago

@DMST1990 nice one! :-) For the FreeCAD workbench, it would be nice to use the Python interface, I mentioned. We can also use parameters of FEM workbench like an installation path of Calculix. If there is only one workflow, the workbench might have only one button, namely "Perform topology optimization". Then I would suggest, a task panel in the left hand side opens like the one for the meshing. There one could select an analysis group (because it is usually complete in the sense that it is possible to perform a full Calculix structural or thermal analysis). Further in the task panel it is possible to select the type of optimization and the parameters, like in your blender interface. Then "run" and it takes off. You mentioned that you need Python3, is there any strict reason for that? Most of the Python3 language constructs are also available in Python2.7, such that I would suggest to make the code compatible. Because FreeCAD is Python2.7 in its standard configuration. Do you use GNU/Linux or Windows? I ask because the workbench executes the Python code within FreeCADs own Python console which in Windows usually has no access to scipy. Maybe we should give an option to use an external Python interpreter, I don't know.

These are my suggestions so far. Maybe I will commit some code in the FreeCAD repo in the next few days. OK?

Best wishes Johannes

Foxelmanian commented 5 years ago

@joha2 Typically there is only one workflow. Build up your FE-Model and then perform an optimization on that. So a simple panel would be enough. I think in the latest release (0.18) FreeCAD uses Python 3.6 (a tleast on my prebuild version). I use several new structures of python3.6 or higher like typing and f-strings. I would stay on Python3.x just because 2.x wont be supported in 2020 any more. Additonally Blender uses Python3.6/3.7 aswell.

Well I use both Windows and Linux (with Visual Studio Code). On Windows you can just add libarys with pip to the FreeCAD Python version.

Just take your time. If you notice something bad (Code, Structure...) or if you would do something different, I would be happy to hear your suggestions/changes or criticisms. And you can commit as much as you want.

Best wishes

Martin