Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while processing file: main_generator.py [global name 'math' is not defined] #373

Closed
Qbort opened this issue Jun 16, 2020 · 3 comments

Comments

@Qbort
Copy link
Contributor

Qbort commented Jun 16, 2020

I'm very new to this script so this might be a non-issue and just me being stupid...

I am on Windows 10, FreeCAD version 0.17 and cadquery_module installed from within FreeCAD.
I have opened command prompt and navigated to cadquery\FCAD_script_generator\QFN_packages and run below two commands:

taskkill -im freecad.exe /f

start "" "C:\Program Files\FreeCAD 0.17\bin\freecad" main_generator.py QFN-16-1EP_3x3mm_Pitch0.5mm

When FreeCAD opens I get below error message in the FreeCAD console:

QFN-16-1EP_3x3mm_Pitch0.5mmException while processing file: main_generator.py [global name 'math' is not defined]
File format not supported: QFN-16-1EP_3x3mm_Pitch0.5mm 

Is this some bug or is my configuration incorrect?

@easyw
Copy link
Owner

easyw commented Jun 16, 2020

@Qbort I cannot test right now, but would you mind to try with FC0.18.4 or FC0.19 to see if you get the same error?
It should work out of the box.

@Qbort
Copy link
Contributor Author

Qbort commented Jun 16, 2020

@easyw i just installed FreeCad 0.18.4 (last stable release) and indeed it works perfectly! Well done for all the hard work on this.
I noticed that FreeCad 0.17 uses Python 2, whereas FreeCad 0.18 uses Python 3.

Issue #315 does mention that Python 2 is now dead, so my conclusion is that this script doesn't actually need to support early versions.

Can I suggest to add a note on README.MD to say that the script is only supported in FreeCad 0.18 or greater (Python 3 support)? Also there are quite a few other documentation files that might need updating - I can submit a PR if you are okay with it?

Qbort added a commit to Qbort/kicad-3d-models-in-freecad that referenced this issue Jun 18, 2020
- 4UCON_17809  - Tested FC 0.17 & FC 0.18
- BGA_packages - Tested FC 0.17 & FC 0.18
- QFN_packages - Tested FC 0.17 & FC 0.18. Fixes issue easyw#373  Note: In FreeCad 0.17 the "Report View" shows the warning "File format not supported: DFN-6-1EP_1.2x1.2mm_P0.4mm_EP0.3x0.94mm ", but it still generates the 3D model

Other fixes / cleanup:
- Removed ribbon.py duplicate in cadquery/FCAD_script_generator/4UCON_17809/cq_models/ribbon.py
- Defined reload_lib() in cq_cad_tools.py
- More functionality to check_requirements() for cleaner code
   *Created open_CQ_Example() - this is required to be called before close_CQ_Example(), otherwise an exception is raised
   *Added tests open_CQ_Example() and close_CQ_Example() into check_requirements().
   *Removed references of close_CQ_Example() in the files from modules 4UCON_17809, BGA_packages and QFN_packages, since this is covered by check_requirements().
@Qbort Qbort mentioned this issue Jun 18, 2020
57 tasks
@Qbort
Copy link
Contributor Author

Qbort commented Jun 30, 2020

fixed by pull request #374

@Qbort Qbort closed this as completed Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants