pyfemtet 1.1.4__tar.gz → 1.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyfemtet might be problematic. Click here for more details.
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/PKG-INFO +1 -1
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/logger/_impl.py +26 -1
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_base_interface.py +4 -4
- pyfemtet-1.1.6/pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +352 -0
- pyfemtet-1.1.6/pyfemtet/opt/interface/_solidworks_interface/sw_const.py +32 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/_base_optimizer.py +5 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +40 -2
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/problem/variable_manager/_variable_manager.py +1 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/pm_graph.py +4 -3
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyproject.toml +1 -1
- pyfemtet-1.1.4/pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +0 -229
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/LICENSE +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/README.md +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/1. make_pot_and_update_po.bat +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/2. build_mo.bat +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/babel.cfg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/i18n.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/locales/messages.pot +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_i18n/messages.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/closing.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/dask_util.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/df_util.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/excel_macro_util.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/excel_parse_util.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/femtet_access_inspection.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/femtet_autosave.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/femtet_exit.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/femtet_version.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/helper.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/process_util.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/sample.xlsx +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/_util/str_enum.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/core.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/dispatch_extensions/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/dispatch_extensions/_impl.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/logger/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/exceptions.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/femopt.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/history/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/history/_history.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/history/_hypervolume.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/history/_optimality.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_dummy_classes.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_excel_interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_excel_interface/excel_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_nx_interface/update_model.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_solidworks_interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_with_excel_settings/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/meta_script/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/meta_script/__main__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/meta_script/sample/sample.bas +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/meta_script/sample/sample.femprj +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/_trial_queue.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/prediction/_botorch_utils.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/prediction/_gpytorch_modules_extension.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/prediction/_helper.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/prediction/_model.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/problem/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/problem/problem.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/problem/variable_manager/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/problem/variable_manager/_string_as_expression.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/__main__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_base_application.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_common_pages.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/alert_region.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/control_femtet.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/detail_graphs.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_complex_components/main_graph.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_detail_page.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_helper.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_process_monitor/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dbc.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dcc.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/html.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/str_enum.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/.gitignore +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/_application.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/_pages.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/plotter/__init__.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/plotter/contour_creator.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/plotter/main_figure_creator.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/plotter/parallel_plot_creator.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/visualization/plotter/pm_graph_creator.py +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/worker_status.py +0 -0
|
@@ -81,6 +81,7 @@ def __create_formatter(colored=True):
|
|
|
81
81
|
# ===== handler config =====
|
|
82
82
|
|
|
83
83
|
STDOUT_HANDLER_NAME = 'stdout-handler'
|
|
84
|
+
STDERR_HANDLER_NAME = 'stderr-handler'
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
def __get_stdout_handler():
|
|
@@ -94,6 +95,17 @@ def __has_stdout_handler(logger):
|
|
|
94
95
|
return any([handler.get_name() != STDOUT_HANDLER_NAME for handler in logger.handlers])
|
|
95
96
|
|
|
96
97
|
|
|
98
|
+
def __get_stderr_handler():
|
|
99
|
+
stderr_handler = logging.StreamHandler(sys.stderr)
|
|
100
|
+
stderr_handler.set_name(STDERR_HANDLER_NAME)
|
|
101
|
+
stderr_handler.setFormatter(__create_formatter(colored=True))
|
|
102
|
+
return stderr_handler
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def __has_stderr_handler(logger):
|
|
106
|
+
return any([handler.get_name() != STDERR_HANDLER_NAME for handler in logger.handlers])
|
|
107
|
+
|
|
108
|
+
|
|
97
109
|
def set_stdout_output(logger, level=logging.INFO):
|
|
98
110
|
|
|
99
111
|
if not __has_stdout_handler(logger):
|
|
@@ -107,6 +119,19 @@ def remove_stdout_output(logger):
|
|
|
107
119
|
logger.removeHandler(__get_stdout_handler())
|
|
108
120
|
|
|
109
121
|
|
|
122
|
+
def set_stderr_output(logger, level=logging.INFO):
|
|
123
|
+
|
|
124
|
+
if not __has_stderr_handler(logger):
|
|
125
|
+
logger.addHandler(__get_stderr_handler())
|
|
126
|
+
|
|
127
|
+
logger.setLevel(level)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def remove_stderr_output(logger):
|
|
131
|
+
if __has_stderr_handler(logger):
|
|
132
|
+
logger.removeHandler(__get_stderr_handler())
|
|
133
|
+
|
|
134
|
+
|
|
110
135
|
def add_file_output(logger, filepath=None, level=logging.INFO) -> str:
|
|
111
136
|
"""Add FileHandler to the logger.
|
|
112
137
|
|
|
@@ -165,7 +190,7 @@ def setup_package_root_logger(package_name):
|
|
|
165
190
|
with __lock:
|
|
166
191
|
logger = logging.getLogger(package_name)
|
|
167
192
|
logger.propagate = True
|
|
168
|
-
|
|
193
|
+
set_stderr_output(logger)
|
|
169
194
|
logger.setLevel(logging.INFO)
|
|
170
195
|
__initialized_root_packages.append(package_name)
|
|
171
196
|
else:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
2
|
+
from typing import TYPE_CHECKING, Callable, Any
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
5
|
import tempfile
|
|
@@ -105,7 +105,7 @@ class AbstractFEMInterface:
|
|
|
105
105
|
|
|
106
106
|
return dst_path_
|
|
107
107
|
|
|
108
|
-
def _get_worker_space(self) -> str
|
|
108
|
+
def _get_worker_space(self) -> str:
|
|
109
109
|
worker = get_worker()
|
|
110
110
|
if worker is None:
|
|
111
111
|
assert hasattr(self, '_tmp_dir'), 'Internal Error! Run _distribute_files() first!'
|
|
@@ -176,12 +176,12 @@ class AbstractFEMInterface:
|
|
|
176
176
|
pass
|
|
177
177
|
|
|
178
178
|
# noinspection PyMethodMayBeStatic,PyUnusedLocal
|
|
179
|
-
def _check_using_fem(self, fun:
|
|
179
|
+
def _check_using_fem(self, fun: Callable) -> bool:
|
|
180
180
|
return False
|
|
181
181
|
|
|
182
182
|
# ===== postprocessing after recording =====
|
|
183
183
|
|
|
184
|
-
def _create_postprocess_args(self) -> dict[str,
|
|
184
|
+
def _create_postprocess_args(self) -> dict[str, Any]:
|
|
185
185
|
return {}
|
|
186
186
|
|
|
187
187
|
@staticmethod
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from time import sleep
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from win32com.client import Dispatch, DispatchEx
|
|
8
|
+
from pythoncom import com_error, CoInitialize
|
|
9
|
+
|
|
10
|
+
from pyfemtet._util.dask_util import *
|
|
11
|
+
from pyfemtet.opt.exceptions import *
|
|
12
|
+
from pyfemtet.opt.interface._base_interface import COMInterface
|
|
13
|
+
from pyfemtet._i18n import _
|
|
14
|
+
from pyfemtet.opt.problem.problem import *
|
|
15
|
+
from pyfemtet.logger import get_module_logger
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
19
|
+
|
|
20
|
+
logger = get_module_logger('opt.interface', False)
|
|
21
|
+
asm_logger = get_module_logger('opt.interface.sldasm', False)
|
|
22
|
+
|
|
23
|
+
# 定数の宣言
|
|
24
|
+
swThisConfiguration = 1 # https://help.solidworks.com/2023/english/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swInConfigurationOpts_e.html
|
|
25
|
+
swAllConfiguration = 2
|
|
26
|
+
swSpecifyConfiguration = 3 # use with ConfigName argument
|
|
27
|
+
swSaveAsCurrentVersion = 0
|
|
28
|
+
swSaveAsOptions_Copy = 2 #
|
|
29
|
+
swSaveAsOptions_Silent = 1 # https://help.solidworks.com/2021/english/api/swconst/solidworks.interop.swconst~solidworks.interop.swconst.swsaveasoptions_e.html
|
|
30
|
+
swSaveWithReferencesOptions_None = 0 # https://help-solidworks-com.translate.goog/2023/english/api/swconst/SolidWorks.Interop.swconst~SolidWorks.Interop.swconst.swSaveWithReferencesOptions_e.html?_x_tr_sl=auto&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=wapp
|
|
31
|
+
swDocPART = 1 # https://help.solidworks.com/2023/english/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swDocumentTypes_e.html
|
|
32
|
+
swDocASSEMBLY = 2
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FileNotOpenedError(Exception):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class EquationContext:
|
|
40
|
+
def __init__(self, swModel) -> None:
|
|
41
|
+
self.swModel = swModel
|
|
42
|
+
self.swEqnMgr = None
|
|
43
|
+
|
|
44
|
+
def __enter__(self):
|
|
45
|
+
# プロパティを退避
|
|
46
|
+
self.swEqnMgr = self.swModel.GetEquationMgr
|
|
47
|
+
self.buffer_aso = self.swEqnMgr.AutomaticSolveOrder
|
|
48
|
+
self.buffer_ar = self.swEqnMgr.AutomaticRebuild
|
|
49
|
+
self.swEqnMgr.AutomaticSolveOrder = False
|
|
50
|
+
self.swEqnMgr.AutomaticRebuild = False
|
|
51
|
+
return self.swEqnMgr
|
|
52
|
+
|
|
53
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
54
|
+
# プロパティをもとに戻す
|
|
55
|
+
assert self.swEqnMgr is not None
|
|
56
|
+
self.swEqnMgr.AutomaticSolveOrder = self.buffer_aso
|
|
57
|
+
self.swEqnMgr.AutomaticRebuild = self.buffer_ar
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class EditPartContext:
|
|
61
|
+
def __init__(self, swModel, component) -> None:
|
|
62
|
+
self.swModel = swModel
|
|
63
|
+
self.component = component
|
|
64
|
+
|
|
65
|
+
def __enter__(self):
|
|
66
|
+
swSelMgr = self.swModel.SelectionManager
|
|
67
|
+
swSelData = swSelMgr.CreateSelectData
|
|
68
|
+
swSelMgr.AddSelectionListObject(self.component, swSelData)
|
|
69
|
+
# self.swModel.EditPart() # 対象がアセンブリの場合動作しない
|
|
70
|
+
self.swModel.AssemblyPartToggle() # Obsolete だが代わりにこれを使う
|
|
71
|
+
|
|
72
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
73
|
+
self.swModel.EditAssembly()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# noinspection PyPep8Naming
|
|
77
|
+
class SolidworksInterface(COMInterface):
|
|
78
|
+
"""
|
|
79
|
+
Interface class for interacting with SolidWorks through COM automation.
|
|
80
|
+
|
|
81
|
+
This class manages the connection and interaction with SolidWorks using its COM interface.
|
|
82
|
+
It handles initialization, visibility, and clean termination of the SolidWorks application.
|
|
83
|
+
|
|
84
|
+
Attributes:
|
|
85
|
+
swApp (CDispatch): The COM dispatch object for SolidWorks application.
|
|
86
|
+
com_members (dict): Mapping of COM member names to their interface strings.
|
|
87
|
+
sldprt_path (str): Absolute path to the SolidWorks part file (.sldprt).
|
|
88
|
+
quit_solidworks_on_terminate (bool): Whether to close SolidWorks upon object destruction.
|
|
89
|
+
solidworks_visible (bool): Whether the SolidWorks application window is visible.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
sldprt_path (str): Path to the SolidWorks part file (.sldprt).
|
|
93
|
+
close_solidworks_on_terminate (bool, optional): If True, SolidWorks will close when this object is destroyed. Defaults to False.
|
|
94
|
+
visible (bool, optional): If True, SolidWorks will be started in visible mode. Defaults to True.
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
AssertionError: If the specified part file does not exist.
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
swApp: Any
|
|
101
|
+
com_members = {'swApp': 'SLDWORKS.Application'}
|
|
102
|
+
_access_sw_lock_name = 'access_sw'
|
|
103
|
+
|
|
104
|
+
def __init__(
|
|
105
|
+
self,
|
|
106
|
+
sldprt_path,
|
|
107
|
+
close_solidworks_on_terminate=False,
|
|
108
|
+
visible=True,
|
|
109
|
+
):
|
|
110
|
+
self.sldprt_path = os.path.abspath(sldprt_path)
|
|
111
|
+
self.quit_solidworks_on_terminate = close_solidworks_on_terminate
|
|
112
|
+
self.solidworks_visible = visible
|
|
113
|
+
|
|
114
|
+
if not os.path.isfile(self.sldprt_path):
|
|
115
|
+
raise FileNotFoundError(self.sldprt_path)
|
|
116
|
+
self._original_sldprt_path = self.sldprt_path
|
|
117
|
+
|
|
118
|
+
def connect_sw(self):
|
|
119
|
+
logger.info(_(
|
|
120
|
+
en_message='Connecting to Solidworks...',
|
|
121
|
+
jp_message='Solidworks に接続しています...'
|
|
122
|
+
))
|
|
123
|
+
try:
|
|
124
|
+
self.swApp = Dispatch('SLDWORKS.Application')
|
|
125
|
+
except com_error:
|
|
126
|
+
raise RuntimeError(_(
|
|
127
|
+
en_message='Failed to instantiate Solidworks. '
|
|
128
|
+
'Please check installation and enabling macro.',
|
|
129
|
+
jp_message='Solidworks のインスタンス化に失敗しました。'
|
|
130
|
+
'Solidworks がインストールされており、'
|
|
131
|
+
'Solidworks マクロが有効であることを確認してください。'))
|
|
132
|
+
self.swApp.Visible = self.solidworks_visible
|
|
133
|
+
|
|
134
|
+
def _setup_before_parallel(self, scheduler_address=None):
|
|
135
|
+
if not _is_assembly(self.sldprt_path):
|
|
136
|
+
self._distribute_files([self.sldprt_path], scheduler_address)
|
|
137
|
+
|
|
138
|
+
def _setup_after_parallel(self, opt: AbstractOptimizer):
|
|
139
|
+
|
|
140
|
+
# validation
|
|
141
|
+
if _is_assembly(self.sldprt_path) and get_worker() is not None:
|
|
142
|
+
# 現在の仕様だと sldprt_path だけが
|
|
143
|
+
# worker_space に保存される。
|
|
144
|
+
# 並列処理に対応するためには
|
|
145
|
+
# すべてのファイルを distribute したうえで
|
|
146
|
+
# 構成部品の置換を実行する必要がある。
|
|
147
|
+
raise RuntimeError(_(
|
|
148
|
+
en_message='Parallel processing is not supported when handling assembly parts with SolidworksInterface.',
|
|
149
|
+
jp_message='SolidworksInterfaceでアセンブリパーツを対象とする場合、並列処理はサポートされていません。'
|
|
150
|
+
))
|
|
151
|
+
|
|
152
|
+
if not _is_assembly(self.sldprt_path):
|
|
153
|
+
# get suffix
|
|
154
|
+
suffix = self._get_file_suffix(opt)
|
|
155
|
+
|
|
156
|
+
# rename and get worker path
|
|
157
|
+
self.sldprt_path = self._rename_and_get_path_on_worker_space(
|
|
158
|
+
self._original_sldprt_path,
|
|
159
|
+
suffix,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# connect solidworks
|
|
163
|
+
CoInitialize()
|
|
164
|
+
with Lock(self._access_sw_lock_name):
|
|
165
|
+
self.connect_sw()
|
|
166
|
+
|
|
167
|
+
# open it
|
|
168
|
+
if _is_assembly(self.sldprt_path):
|
|
169
|
+
self.swApp.OpenDoc(self.sldprt_path, swDocASSEMBLY)
|
|
170
|
+
else:
|
|
171
|
+
self.swApp.OpenDoc(self.sldprt_path, swDocPART)
|
|
172
|
+
|
|
173
|
+
@property
|
|
174
|
+
def swModel(self):
|
|
175
|
+
return _get_model_by_basename(self.swApp, os.path.basename(self.sldprt_path))
|
|
176
|
+
|
|
177
|
+
def update(self) -> None:
|
|
178
|
+
raise NotImplementedError
|
|
179
|
+
|
|
180
|
+
def update_parameter(self, x: TrialInput) -> None:
|
|
181
|
+
|
|
182
|
+
COMInterface.update_parameter(self, x)
|
|
183
|
+
|
|
184
|
+
# sw はプロセスが一つなので Lock
|
|
185
|
+
with Lock(self._access_sw_lock_name):
|
|
186
|
+
sleep(0.2)
|
|
187
|
+
swModel = self.swModel
|
|
188
|
+
mgr = _UpdateVariableManager()
|
|
189
|
+
mgr._update_global_variables(swModel, self.current_prm_values)
|
|
190
|
+
|
|
191
|
+
def update_model(self):
|
|
192
|
+
"""Update .sldprt"""
|
|
193
|
+
|
|
194
|
+
# sw はプロセスが一つなので Lock
|
|
195
|
+
with Lock(self._access_sw_lock_name):
|
|
196
|
+
sleep(0.2)
|
|
197
|
+
|
|
198
|
+
swModel = self.swModel
|
|
199
|
+
result = swModel.EditRebuild3 # モデル再構築
|
|
200
|
+
if not result:
|
|
201
|
+
raise ModelError(_(
|
|
202
|
+
en_message='Failed to update the model on Solidworks.',
|
|
203
|
+
jp_message='Solidworks モデルの更新に失敗しました。'
|
|
204
|
+
))
|
|
205
|
+
|
|
206
|
+
def close(self):
|
|
207
|
+
if not hasattr(self, 'swApp'):
|
|
208
|
+
return
|
|
209
|
+
|
|
210
|
+
if self.swApp is None:
|
|
211
|
+
return
|
|
212
|
+
|
|
213
|
+
with Lock(self._access_sw_lock_name):
|
|
214
|
+
model_name = os.path.basename(self.sldprt_path)
|
|
215
|
+
logger.info(_(
|
|
216
|
+
en_message='Closing {model_name} ...',
|
|
217
|
+
jp_message='モデル {model_name} を閉じています...',
|
|
218
|
+
model_name=model_name,
|
|
219
|
+
))
|
|
220
|
+
|
|
221
|
+
# 最後の Doc ならばプロセスを落とす仕様?
|
|
222
|
+
self.swApp.QuitDoc(os.path.basename(self.sldprt_path))
|
|
223
|
+
# logger.info(Msg.F_SW_MODEL_CLOSED(model_name))
|
|
224
|
+
logger.info(_(
|
|
225
|
+
en_message='Successfully closed {model_name}.',
|
|
226
|
+
jp_message='モデル {model_name} を閉じました。',
|
|
227
|
+
model_name=model_name,
|
|
228
|
+
))
|
|
229
|
+
sleep(3)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _is_assembly(swModel_or_name):
|
|
233
|
+
if isinstance(swModel_or_name, str):
|
|
234
|
+
return swModel_or_name.lower().endswith('.sldasm')
|
|
235
|
+
else:
|
|
236
|
+
return swModel_or_name.GetPathName.lower().endswith('.sldasm')
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def _iter_parts(swModel):
|
|
240
|
+
components = swModel.GetComponents(
|
|
241
|
+
False # TopOnly
|
|
242
|
+
)
|
|
243
|
+
return components
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class _UpdateVariableManager:
|
|
247
|
+
|
|
248
|
+
def __init__(self):
|
|
249
|
+
self.updated_variables = set()
|
|
250
|
+
|
|
251
|
+
def _update_global_variables(self, swModel, x: TrialInput):
|
|
252
|
+
# まず自身のパラメータを更新
|
|
253
|
+
asm_logger.debug(f'Processing `{swModel.GetPathName}`')
|
|
254
|
+
self._update_global_variables_core(swModel, x)
|
|
255
|
+
|
|
256
|
+
# アセンブリならば、構成部品のパラメータを更新
|
|
257
|
+
if _is_assembly(swModel):
|
|
258
|
+
components = _iter_parts(swModel)
|
|
259
|
+
for component in components:
|
|
260
|
+
swPartModel = component.GetModelDoc2
|
|
261
|
+
asm_logger.debug(f'Checking `{swPartModel.GetPathName}`')
|
|
262
|
+
if swPartModel.GetPathName.lower() not in self.updated_variables:
|
|
263
|
+
asm_logger.debug(f'Processing `{swPartModel.GetPathName}`')
|
|
264
|
+
with EditPartContext(swModel, component):
|
|
265
|
+
self._update_global_variables_core(swPartModel, x)
|
|
266
|
+
self.updated_variables.add(swPartModel.GetPathName.lower())
|
|
267
|
+
|
|
268
|
+
def _update_global_variables_core(self, swModel, x: TrialInput):
|
|
269
|
+
with EquationContext(swModel) as swEqnMgr:
|
|
270
|
+
# txt にリンクされている場合は txt を更新
|
|
271
|
+
if swEqnMgr.LinkToFile:
|
|
272
|
+
self._update_global_variables_linked_txt(swEqnMgr, x)
|
|
273
|
+
self._update_global_variables_simple(swEqnMgr, x)
|
|
274
|
+
# noinspection PyStatementEffect
|
|
275
|
+
swEqnMgr.EvaluateAll
|
|
276
|
+
|
|
277
|
+
def _update_global_variables_linked_txt(self, swEqnMgr, x: TrialInput):
|
|
278
|
+
txt_path = swEqnMgr.FilePath
|
|
279
|
+
if txt_path in self.updated_variables:
|
|
280
|
+
return
|
|
281
|
+
with open(txt_path, 'r', encoding='utf_8_sig') as f:
|
|
282
|
+
equations = [line.strip() for line in f.readlines() if line.strip() != '']
|
|
283
|
+
for i, eq in enumerate(equations):
|
|
284
|
+
equations[i] = self._update_equation(eq, x)
|
|
285
|
+
with open(txt_path, 'w', encoding='utf_8_sig') as f:
|
|
286
|
+
f.writelines([eq + '\n' for eq in equations])
|
|
287
|
+
asm_logger.debug(f'`{txt_path}` is updated.')
|
|
288
|
+
self.updated_variables.add(txt_path)
|
|
289
|
+
|
|
290
|
+
def _update_global_variables_simple(self, swEqnMgr, x: TrialInput):
|
|
291
|
+
nEquation = swEqnMgr.GetCount
|
|
292
|
+
|
|
293
|
+
# equation を列挙
|
|
294
|
+
asm_logger.debug(f'{nEquation} equations detected.')
|
|
295
|
+
for i in range(nEquation):
|
|
296
|
+
# name, equation の取得
|
|
297
|
+
eq = swEqnMgr.Equation(i)
|
|
298
|
+
prm_name = self._get_left(eq)
|
|
299
|
+
# COM 経由なので必要な時以外は触らない
|
|
300
|
+
asm_logger.debug(f'Checking `{prm_name}`')
|
|
301
|
+
if (prm_name in x) and (prm_name not in self.updated_variables):
|
|
302
|
+
asm_logger.debug(f'Processing `{prm_name}`')
|
|
303
|
+
# 特定の Equation がテキストリンク有効か
|
|
304
|
+
# どうかを判定する術がないので、一旦更新する
|
|
305
|
+
new_eq = self._update_equation(eq, x)
|
|
306
|
+
swEqnMgr.Equation(i, new_eq)
|
|
307
|
+
# テキストリンクの場合、COM インスタンスに
|
|
308
|
+
# 更新された値が残ってしまうのでテキストを再読み込み
|
|
309
|
+
if swEqnMgr.LinkToFile:
|
|
310
|
+
# noinspection PyStatementEffect
|
|
311
|
+
swEqnMgr.UpdateValuesFromExternalEquationFile
|
|
312
|
+
self.updated_variables.add(prm_name)
|
|
313
|
+
|
|
314
|
+
def _update_equation(self, equation: str, x: TrialInput):
|
|
315
|
+
prm_name = self._get_left(equation)
|
|
316
|
+
if prm_name not in x:
|
|
317
|
+
return equation
|
|
318
|
+
prm = x[prm_name]
|
|
319
|
+
right = str(prm.value) + prm.properties.get('unit', '')
|
|
320
|
+
new_eq = f'"{prm_name}" = {right}'
|
|
321
|
+
asm_logger.debug(f'New eq.: `{new_eq}`')
|
|
322
|
+
return new_eq
|
|
323
|
+
|
|
324
|
+
@staticmethod
|
|
325
|
+
def _get_left(equation: str):
|
|
326
|
+
return equation.split('=')[0].strip('" ')
|
|
327
|
+
|
|
328
|
+
@staticmethod
|
|
329
|
+
def _load(swModel):
|
|
330
|
+
# テスト用関数
|
|
331
|
+
out = set()
|
|
332
|
+
swEqnMgr = swModel.GetEquationMgr
|
|
333
|
+
for i in range(swEqnMgr.GetCount):
|
|
334
|
+
eq = swEqnMgr.Equation(i)
|
|
335
|
+
out.add(eq)
|
|
336
|
+
if _is_assembly(swModel):
|
|
337
|
+
components = _iter_parts(swModel)
|
|
338
|
+
for component in components:
|
|
339
|
+
swPartModel = component.GetModelDoc2
|
|
340
|
+
swEqnMgr = swPartModel.GetEquationMgr
|
|
341
|
+
for i in range(swEqnMgr.GetCount):
|
|
342
|
+
eq = swEqnMgr.Equation(i)
|
|
343
|
+
out.add(eq)
|
|
344
|
+
return out
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
# noinspection PyPep8Naming
|
|
348
|
+
def _get_model_by_basename(swApp, basename):
|
|
349
|
+
swModel = swApp.ActivateDoc(basename)
|
|
350
|
+
if swModel is None:
|
|
351
|
+
raise FileNotOpenedError(f'Model {basename} is not opened.')
|
|
352
|
+
return swModel
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# https://help.solidworks.com/2026/English/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swDocumentTypes_e.html
|
|
2
|
+
swDocASSEMBLY = 2
|
|
3
|
+
swDocDRAWING = 3
|
|
4
|
+
swDocIMPORTED_ASSEMBLY = 7
|
|
5
|
+
swDocIMPORTED_PART = 6
|
|
6
|
+
swDocLAYOUT = 5
|
|
7
|
+
swDocNONE = 0
|
|
8
|
+
swDocPART = 1
|
|
9
|
+
swDocSDM = 4
|
|
10
|
+
|
|
11
|
+
# https://help.solidworks.com/2026/English/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swOpenDocOptions_e.html
|
|
12
|
+
swOpenDocOptions_AdvancedConfig = 8192 or 0x2000 # Open assembly using an advanced configuration
|
|
13
|
+
swOpenDocOptions_AutoMissingConfig = 32 or 0x20 # Obsolete # do not use
|
|
14
|
+
# The software automatically uses the last-used configuration of a model when it discovers missing configurations or component references as it silently opens drawings and assemblies.
|
|
15
|
+
|
|
16
|
+
swOpenDocOptions_DontLoadHiddenComponents = 256 or 0x100 # By default, hidden components are loaded when you open an assembly document. Set swOpenDocOptions_DontLoadHiddenComponents to not load hidden components when opening an assembly document
|
|
17
|
+
swOpenDocOptions_LDR_EditAssembly = 2048 or 0x800 # Open in Large Design Review (resolved) mode with edit assembly enabled # use in combination with swOpenDocOptions_ViewOnly
|
|
18
|
+
swOpenDocOptions_LoadExternalReferencesInMemory = 512 or 0x200 # Open external references in memory only # this setting is valid only if swUserPreferenceIntegerValue_e.swLoadExternalReferences is not set to swLoadExternalReferences_e.swLoadExternalReferences_None
|
|
19
|
+
# swUserPreferenceToggle_e.swExtRefLoadRefDocsInMemory (System Options > External References > Load documents in memory only) is ignored when opening documents through the API because IDocumentSpecification::LoadExternalReferencesInMemory and ISldWorks::OpenDoc6 (swOpenDocOptions_e.swOpenDocOptions_LoadExternalReferencesInMemory) have sole control of reference loading
|
|
20
|
+
|
|
21
|
+
swOpenDocOptions_LoadLightweight = 128 or 0x80 # Open assembly document as lightweight
|
|
22
|
+
# NOTE: The default for whether an assembly document is opened lightweight is based on a registry setting accessed via Tools, Options, Assemblies or with the user preference setting swAutoLoadPartsLightweight
|
|
23
|
+
# To override the default and specify a value with ISldWorks::OpenDoc6, set swOpenDocOptions_OverrideDefaultLoadLightweight. If set, then you can set swOpenDocOptions_LoadLightweight to open an assembly document as lightweight
|
|
24
|
+
|
|
25
|
+
swOpenDocOptions_LoadModel = 16 or 0x10 # Load Detached model upon opening document (drawings only)
|
|
26
|
+
swOpenDocOptions_OpenDetailingMode = 1024 or 0x400 # Open document in detailing mode
|
|
27
|
+
swOpenDocOptions_OverrideDefaultLoadLightweight = 64 or 0x40 # Override default setting whether to open an assembly document as lightweight
|
|
28
|
+
swOpenDocOptions_RapidDraft = 8 or 0x8 # Convert document to Detached format (drawings only)
|
|
29
|
+
swOpenDocOptions_ReadOnly = 2 or 0x2 # Open document read only
|
|
30
|
+
swOpenDocOptions_Silent = 1 or 0x1 # Open document silently
|
|
31
|
+
swOpenDocOptions_SpeedPak = 4096 or 0x1000 # Open document using the SpeedPak option
|
|
32
|
+
swOpenDocOptions_ViewOnly = 4 or 0x4 # Open document in Large Design Review mode (assemblies only)
|
|
@@ -4,6 +4,7 @@ import datetime
|
|
|
4
4
|
from typing import Callable, TypeAlias, Sequence, Literal
|
|
5
5
|
from numbers import Real # マイナーなので型ヒントでは使わず、isinstance で使う
|
|
6
6
|
from time import sleep
|
|
7
|
+
import os
|
|
7
8
|
|
|
8
9
|
import sympy
|
|
9
10
|
|
|
@@ -871,6 +872,10 @@ class AbstractOptimizer:
|
|
|
871
872
|
|
|
872
873
|
self.worker_status.value = WorkerStatus.running
|
|
873
874
|
|
|
875
|
+
if os.environ.get('DEBUG_FEMOPT_PARALLEL'):
|
|
876
|
+
if isinstance(worker_idx, int):
|
|
877
|
+
sleep(worker_idx)
|
|
878
|
+
|
|
874
879
|
self.run()
|
|
875
880
|
|
|
876
881
|
logger.info(_(
|
{pyfemtet-1.1.4 → pyfemtet-1.1.6}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py
RENAMED
|
@@ -43,6 +43,20 @@ warnings.filterwarnings('ignore', 'Argument ``constraints_func`` is an experimen
|
|
|
43
43
|
_MESSAGE_ENQUEUED = 'Enqueued trial.'
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
def check_float_and_raise(value, check_target):
|
|
47
|
+
if isinstance(value, int | float):
|
|
48
|
+
if np.isnan(value):
|
|
49
|
+
raise ValueError(_(
|
|
50
|
+
en_message=f'{check_target} is NaN.',
|
|
51
|
+
jp_message=f'{check_target} は NaN です。',
|
|
52
|
+
))
|
|
53
|
+
else:
|
|
54
|
+
raise ValueError(_(
|
|
55
|
+
en_message=f'{check_target} should be a number, but {value} ({type(value)}) passed.',
|
|
56
|
+
jp_message=f'{check_target} は数値でなくてはなりませんが、{value} ({type(value)}) が与えられました。',
|
|
57
|
+
))
|
|
58
|
+
|
|
59
|
+
|
|
46
60
|
class MaxTrialsCallbackExcludingEnqueued(MaxTrialsCallback):
|
|
47
61
|
def __call__(self, study: Study, trial: FrozenTrial) -> None:
|
|
48
62
|
"""
|
|
@@ -167,14 +181,31 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
167
181
|
self,
|
|
168
182
|
name: str,
|
|
169
183
|
initial_value: float,
|
|
170
|
-
lower_bound: float,
|
|
171
|
-
upper_bound: float,
|
|
184
|
+
lower_bound: float | None = None,
|
|
185
|
+
upper_bound: float | None = None,
|
|
172
186
|
step: float | None = None,
|
|
173
187
|
properties: dict[str, ...] | None = None,
|
|
174
188
|
*,
|
|
175
189
|
pass_to_fem: bool = True,
|
|
176
190
|
fix: bool = False,
|
|
177
191
|
) -> None:
|
|
192
|
+
|
|
193
|
+
if lower_bound is None or upper_bound is None:
|
|
194
|
+
properties = properties or {}
|
|
195
|
+
if properties.get('dynamic_bounds_fun') is None:
|
|
196
|
+
raise ValueError(_(
|
|
197
|
+
en_message='When using `OptunaOptimizer`, you must either specify `lower_bound` and `upper_bound`, ' \
|
|
198
|
+
'or include `dynamic_bounds_fun` (Callable[[AbstractOptimizer], float]) in `properties`.',
|
|
199
|
+
jp_message='OptunaOptimizer では、lower_bound と upper_bound を両方指定するか、' \
|
|
200
|
+
'または properties に dynamic_bounds_fun (Callable[[AbstractOptimizer], float]) ' \
|
|
201
|
+
'を含めなければなりません。'
|
|
202
|
+
))
|
|
203
|
+
else:
|
|
204
|
+
logger.warning(_(
|
|
205
|
+
en_message='`dynamic_bounds_fun` is under development. The functionally can be changed without any announcement.',
|
|
206
|
+
jp_message='dynamic_bounds_fun は開発中の機能です。機能は予告なく変更されることがあります。',
|
|
207
|
+
))
|
|
208
|
+
|
|
178
209
|
AbstractOptimizer.add_parameter(self, name, initial_value, lower_bound, upper_bound, step, properties,
|
|
179
210
|
pass_to_fem=pass_to_fem, fix=fix)
|
|
180
211
|
|
|
@@ -271,6 +302,13 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
271
302
|
continue
|
|
272
303
|
|
|
273
304
|
if isinstance(prm, NumericParameter):
|
|
305
|
+
dynamic_bounds_fun = prm.properties.get('dynamic_bounds_fun')
|
|
306
|
+
if dynamic_bounds_fun:
|
|
307
|
+
lb, ub = dynamic_bounds_fun(self)
|
|
308
|
+
check_float_and_raise(lb, _(f'lower_bound of {prm.name}', f'{prm.name} の lower_bound'))
|
|
309
|
+
check_float_and_raise(ub, _(f'upper_bound of {prm.name}', f'{prm.name} の upper_bound'))
|
|
310
|
+
prm.lower_bound = lb
|
|
311
|
+
prm.upper_bound = ub
|
|
274
312
|
prm.value = trial.suggest_float(
|
|
275
313
|
name,
|
|
276
314
|
prm.lower_bound,
|
|
@@ -428,9 +428,10 @@ class PredictionModelGraph(AbstractPage):
|
|
|
428
428
|
self.CommandState.ready.value,
|
|
429
429
|
self.alert_region.create_alerts(
|
|
430
430
|
_(
|
|
431
|
-
en_message='Cannot draw the graph because
|
|
432
|
-
'
|
|
433
|
-
|
|
431
|
+
en_message='Cannot draw the graph because '
|
|
432
|
+
'the bounds of selected parameter '
|
|
433
|
+
'are not given.',
|
|
434
|
+
jp_message='選択された変数は上下限が与えられていないため、'
|
|
434
435
|
'グラフを描画できません。',
|
|
435
436
|
),
|
|
436
437
|
color='danger',
|