Topology optimization

About the development of the FEM module/workbench.

Moderator: bernd

fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Post by fandaL »

Bercebus wrote: Thu Dec 12, 2019 7:50 pm Is it possible to convert the optimized FEM mesh into a solid infill? I can only get a hollow mesh after exporting it as a .stl and then importing it into the PART module.
You can select the mesh and use command from Part workbench: Part → Create shape from mesh…

It works on geometric meshes (e.g. as you import from stl). FreeCAD can convert also FEM meshes but they need to be first converted to geometric mesh in the FEM workbench: Mesh → FEM mesh to mesh

You can get easily to difficulties with working with geometry converted from mesh due to many faces. It can be partially useful to refine at least flat faces of new geometry (Part → Refine shape), but in case of topologically optimizer results there are often not much of them.
Imported mesh also often contains errors which (if not much serious) can be repaired in the Mesh module: Meshes → Analyze → Evaluate and repair mesh…
Bercebus
Posts: 9
Joined: Sun Oct 16, 2016 10:23 am

Re: Topology optimization

Post by Bercebus »

Thank you very much, fandaL

Is it possible to use these macros on Linux or do they need some code adaptations?

Best regards
Last edited by Bercebus on Fri Dec 13, 2019 10:47 pm, edited 1 time in total.
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Post by fandaL »

It is written in python and uses libraries which are available in FreeCAD, CalculiX path is taken from path defined in FreeCAD FEM settings so it should work on both Linux and Windows fluently. I did not try it on MAC. You need FreeCAD 0.18 or 0.19.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Topology optimization

Post by Jee-Bee »

fandaL wrote: Fri Dec 13, 2019 10:20 pm I did not try it on MAC. You need FreeCAD 0.18 or 0.19.
I tried it on i think 0.18 on osx some time back but not recently
Harpz
Posts: 1
Joined: Fri Mar 20, 2020 7:31 pm

Re: Topology optimization

Post by Harpz »

Hi,

I am having trouble getting this macro to work. I am unable to select a domain in the macro GUI and am receiving the error "None optimized domain has been found. Check your inputs." in the log file.

Thanks!
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Post by fandaL »

Hi and welcome to the forum.
Supposing you use new FreeCAD version 0.19, some naming has changed since I tested it last time. It should be fixed now (by added new lines 466 and 467 in beso_fc_gui.py https://github.com/fandaL/beso/commit/9 ... c4d8656dbd ).
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Topology optimization

Post by bernd »

if your intention is type checking of FEM object better to use https://github.com/FreeCAD/FreeCAD/blob ... ols.py#L39 if inside an analysis (see module end for examples) or for single type checking see https://github.com/FreeCAD/FreeCAD/blob ... ils.py#L86 all type can be found here: https://github.com/FreeCAD/FreeCAD/blob ... ct.py#L149
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Topology optimization

Post by uwestoehr »

I am stepping through the release announcement of FC 0.19 to update the Wiki accordingly. This way I found this feature.

When using the addon manager I don't find a macro named "Beso". Can you please add it so that beso can be installed via the AddonManager?

I can use the macro but as it is, it needs some work until everything is set up. Thus having Beso in our addon manager would be very helpful.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Topology optimization

Post by uwestoehr »

One remark: after starting the optimization, Windows steps quickly in telling me the application is not responding. It attempts to stop it. Can you therefore please have a look. The program needs of course a lot of time until it finished the calculation, but it must tell the OS that it is still alive.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Topology optimization

Post by uwestoehr »

DMST1990 wrote: Tue Dec 11, 2018 1:42 pm I created a macro for FreeCAD, so you can define a model in FreeCAD
Many thanks. However, I cannot find your addon on the Addon Manager of FreeCAD. Can you please add your macro there?

I tried ToOptix via
https://github.com/VoxelBeaver/ToOptixFreeCADAddon
But the instructions there are outdated. At least the development version of FreeCAD 0.19 uses by default Python 3 (despite Python 2 is still supported). So I have Python 3 with FreeCAD, but when executing ToOptix, I get:

Code: Select all

<class 'SyntaxError'>: ('invalid syntax', ('C:/Users/stoehr/AppData/Roaming/FreeCAD/Macro/FreeCADMacro.py', 9, 35, 'python3_path = # Enter python path\n'))
Therefore It would be cool, if this path is automatically detected.

However, I tried to add the path by myself, but get

Code: Select all

<class 'SyntaxError'>: ("(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \\UXXXXXXXX escape", ('C:/Users/stoehr/AppData/Roaming/FreeCAD/Macro/FreeCADMacro.py', 10, 20, "installation_path = 'C:\\Users\\stoehr\\AppData\\Roaming\\FreeCAD\\Macro'\n"))
In the macro I have this:

Code: Select all

python3_path = 'D:\FreeCAD-build\FreeCADLibs_12.3.2_x64_VC15\bin'
installation_path = 'C:\Users\stoehr\AppData\Roaming\FreeCAD\Macro'
So one first have to learn Python to understand that '\' has to be input as '\\'.

OK, I managed to specify the path to Python 3, but then I get this error:

Code: Select all

  File "C:/Users/stoehr/AppData/Roaming/FreeCAD/Macro/FreeCADMacro.py", line 14, in <module>
    import commands
<class 'ModuleNotFoundError'>: No module named 'commands'
I am now stuck. What do I have to do?

my system:

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22440 (Git)
Build type: Release
Branch: master
Hash: 42d643c8f70df94944cf87848574b79ab536f888
Python version: 3.6.8
Qt version: 5.12.6
Coin version: 4.0.0a
OCC version: 7.4.0.beta
Locale: German/Germany (de_DE)
Post Reply