I'm having a go at implementing what I described above in the current FreeCAD codebase, started with the non-gui modules just to give it a go and it seems to be working pretty well.
Code: Select all
FreeCAD 0.17, Libs: 0.17R10506 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2017
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
Submodule freecad.modules.arch, is a package: True
Submodule freecad.modules.startpage, is a package: True
During initialization the error No module named init occurred in freecad.modules.startpage
Submodule freecad.modules.test, is a package: True
Submodule freecad.modules.tux, is a package: True
During initialization the error No module named init occurred in freecad.modules.tux
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> FreeCAD.getExportType()
{'dae': 'importDAE', 'html': 'importWebGL', 'obj': 'importOBJ', 'ifc': 'importIFC'}
>>> FreeCAD.getImportType()
{'dae': 'importDAE', 'obj': 'importOBJ', 'zip': 'importSH3D', '3ds': 'import3DS', 'ifc': 'importIFC', 'FCStd': 'FreeCAD'}
>>> import freecad.modules
>>> freecad.modules.__path__
['/home/simon/src/simonvanderveldt/freecad-build/Mod/freecad/modules']
This is produced by the following WIP code
https://github.com/simonvanderveldt/Fre ... ce-modules. The import code has gotten a lot simpler.
This branch only contains the changes on the importer side, the actual modules still need to be changed, for now I just did so on my local filesystem.
Code: Select all
~/s/s/freecad-build ❯ tree -d Mod/freecad
Mod/freecad
└── modules
├── arch
│ ├── Dice3DS
│ ├── Presets
│ └── Resources
│ ├── icons
│ ├── translations
│ └── ui
├── startpage
├── test
│ └── Gui
│ └── Resources
│ ├── icons
│ └── translations
└── tux
Note that I'm using
freecad.modules as package name because I have no experience with combining this with a built-in (C based) package like
FreeCAD and because package names should actually be all lower case according to PEP-8.
Next up is doing the same for the GUI init.
GUI seems to work as well
Code: Select all
Log: Init: Creating Gui::Application and QApplication
Log: Local server 'FreeCAD' started
Log: OpenGL version 3.0 or higher is present
Log: Run Gui init script
Log: Init: Running FreeCADGuiInit.py start script...
Log: Init: Searching for modules...
Log: Submodule freecad.modules.arch, is a package: True
Log: Initializing freecad.modules.arch
Err: During initialization the error No module named Arch_rc occurred in freecad.modules.arch
Log: Submodule freecad.modules.startpage, is a package: True
Log: Initializing freecad.modules.startpage
Err: During initialization the error No module named init_gui occurred in freecad.modules.startpage
Log: Submodule freecad.modules.test, is a package: True
Log: Initializing freecad.modules.test
Err: During initialization the error No module named init_gui occurred in freecad.modules.test
Log: Submodule freecad.modules.tux, is a package: True
Log: Initializing freecad.modules.tux
Log: Init: Loading FreeCAD GUI