Ccx analysis failed - no attribute 'ccx_binary'

About the development of the FEM module/workbench.

Moderator: bernd

Curlyy
Posts: 3
Joined: Wed Jul 11, 2018 2:30 pm

Ccx analysis failed - no attribute 'ccx_binary'

Postby Curlyy » Thu Jul 12, 2018 10:21 am

Hello,

I'm following the tutorial at https://www.freecadweb.org/wiki/FEM_Tutorial_Python/en and i experiment an error when i want to perform the CCX analysis :

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\FreeCAD 0.17\Mod\Fem\femtools\ccxtools.py", line 648, in start_ccx
    p = subprocess.Popen([self.ccx_binary, "-i ", f.baseName()],
AttributeError: 'FemToolsCcx' object has no attribute 'ccx_binary'
It's happening during "fea.run()" in the code :

Code: Select all

from femtools import ccxtools

fea = ccxtools.FemToolsCcx(App.ActiveDocument.Analysis, App.ActiveDocument.CalculiX, test_mode =True)
fea.update_objects()
message = fea.check_prerequisites()
if not message:
	fea.reset_all()
	fea.run()
	fea.load_results()
else:
	print("Houston, we have a problem! {}\n".format(message))
I have no problem to execute an analysis with the Gui or simply by executing the .inp file with Ccx. The rest of the code is very simillar to the one of the tutorial. (i running the last update of FreeCAD and i'm on Windows 10).

Thank you for your time/help !
anastassia
Posts: 5
Joined: Mon Dec 03, 2018 9:03 am

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby anastassia » Thu Dec 06, 2018 10:12 am

Curlyy, hello, you managed to solve the problem with AttributeError: 'FemToolsCcx' object has no attribute 'ccx_binary' ?
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Thu Dec 06, 2018 2:09 pm

moved to FEM
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Thu Dec 06, 2018 2:10 pm

Curlyy wrote:
Thu Jul 12, 2018 10:21 am
I have no problem to execute an analysis with the Gui or simply by executing the .inp file with Ccx. The rest of the code is very simillar to the one of the tutorial. (i running the last update of FreeCAD and i'm on Windows 10).

Thank you for your time/help !
which version do you run? 0.17 or 0.18
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Thu Dec 06, 2018 2:18 pm

would you try the following ...

- start FreeCAD
- open the 3D FEM example from Start WB
- run the following code

Code: Select all

doc = App.ActiveDocument
import FemGui
FemGui.setActiveAnalysis(doc.Analysis)
from femtools import ccxtools
fea = ccxtools.FemToolsCcx()
fea.reset_all()  # results will be deleted
and

Code: Select all

# run new analysis
fea.update_objects()
message = fea.check_prerequisites()
if not message:
    fea.reset_all()
    fea.run()
    fea.load_results()
else:
    FreeCAD.Console.PrintError("Houston, we have a problem! {}\n".format(message))  # in report view
    print("Houston, we have a problem! {}\n".format(message))  # in python console

# 
The analysis is performed, the results are loaded and a new result object is created for me on:

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15321 (Git)
Build type: Release
Branch: master
Hash: ef002fdde2f2626c3fd04afea3d54e145d4ecdb0
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Thu Dec 06, 2018 2:21 pm

would you try the latest 0.18 version from https://github.com/FreeCAD/FreeCAD/releases it worked for me. See last post.
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Thu Dec 06, 2018 2:31 pm

found the problem ...

Code: Select all

# you should use 
fea = ccxtools.FemToolsCcx()
# or may be 
fea = ccxtools.FemToolsCcx(your_analysis, your_solver)
# But
fea = ccxtools.FemToolsCcx(analysis, solver, test_mode=True)
# should only be used if you explizit would like to use the test_mode or at some special circumstanzes  ... 
anastassia
Posts: 5
Joined: Mon Dec 03, 2018 9:03 am

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby anastassia » Fri Dec 07, 2018 12:57 pm

bernd, thank you, now everything works
anastassia
Posts: 5
Joined: Mon Dec 03, 2018 9:03 am

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby anastassia » Fri Dec 07, 2018 1:00 pm

Tell me how to write files if I spend more than one calculation? (only the file of the last calculation is saved)
User avatar
bernd
Posts: 6404
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ccx analysis failed - no attribute 'ccx_binary'

Postby bernd » Fri Dec 07, 2018 4:19 pm

anastassia wrote:
Fri Dec 07, 2018 1:00 pm
Tell me how to write files if I spend more than one calculation? (only the file of the last calculation is saved)
would you explain a bit more in detail what you would like to do?