pyfemtet 1.1.5__tar.gz → 1.2.0__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.5 → pyfemtet-1.2.0}/PKG-INFO +1 -1
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/messages.py +0 -1
- pyfemtet-1.2.0/pyfemtet/_util/atmark_support_for_param_name.py +2 -0
- pyfemtet-1.2.0/pyfemtet/_util/solidworks_variable.py +169 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/femopt.py +14 -13
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_base_interface.py +4 -4
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_excel_interface/excel_interface.py +4 -2
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py +36 -27
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +49 -70
- pyfemtet-1.2.0/pyfemtet/opt/interface/_solidworks_interface/sw_const.py +32 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/_base_optimizer.py +21 -9
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/problem/variable_manager/_string_as_expression.py +10 -1
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/problem/variable_manager/_variable_manager.py +16 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyproject.toml +1 -1
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/LICENSE +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/README.md +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/1. make_pot_and_update_po.bat +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/2. build_mo.bat +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/babel.cfg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/i18n.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_i18n/locales/messages.pot +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/closing.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/dask_util.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/df_util.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/excel_macro_util.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/excel_parse_util.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/femtet_access_inspection.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/femtet_autosave.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/femtet_exit.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/femtet_version.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/helper.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/process_util.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/sample.xlsx +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/_util/str_enum.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/core.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/dispatch_extensions/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/dispatch_extensions/_impl.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/logger/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/logger/_impl.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/exceptions.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/history/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/history/_history.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/history/_hypervolume.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/history/_optimality.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_dummy_classes.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_excel_interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_nx_interface/update_model.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_solidworks_interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_with_excel_settings/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/meta_script/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/meta_script/__main__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/meta_script/sample/sample.bas +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/meta_script/sample/sample.femprj +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/_trial_queue.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/prediction/_botorch_utils.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/prediction/_gpytorch_modules_extension.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/prediction/_helper.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/prediction/_model.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/problem/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/problem/problem.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/problem/variable_manager/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/__main__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_base_application.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_common_pages.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/alert_region.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/control_femtet.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/detail_graphs.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/main_graph.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_complex_components/pm_graph.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_detail_page.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_helper.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dbc.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dcc.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/html.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/str_enum.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/.gitignore +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/_application.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/_pages.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/plotter/__init__.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/plotter/contour_creator.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/plotter/main_figure_creator.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/plotter/parallel_plot_creator.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/visualization/plotter/pm_graph_creator.py +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/worker_status.py +0 -0
|
@@ -59,7 +59,6 @@ class Message:
|
|
|
59
59
|
ERR_RUN_JOURNAL_NOT_FOUND = _(r'"%UGII_BASE_DIR%\NXBIN\run_journal.exe" is not found. Make sure you have NX installed and the environment variable UGII_BASE_DIR is set.')
|
|
60
60
|
ERR_MODEL_RECONSTRUCTION_FAILED = _('Model reconstruction failed.')
|
|
61
61
|
ERR_MODEL_UPDATE_FAILED = _('Model update failed.')
|
|
62
|
-
ERR_NO_MAKEPY = _('It was detected that the configuration of Femtet python macro constants has not been completed. The configuration was done automatically (python -m win32com.client.makepy FemtetMacro). Please restart the program. If the error persists, please run "py -m win32com.client.makepy FemtetMacro" or "python -m win32com.client.makepy FemtetMacro" on the command prompt.')
|
|
63
62
|
ERR_FEMTET_CONNECTION_FAILED = _('Failed to connect to Femtet.')
|
|
64
63
|
|
|
65
64
|
@staticmethod
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from typing import TypeAlias
|
|
2
|
+
|
|
3
|
+
SWVariables: TypeAlias = dict[str, str]
|
|
4
|
+
"""<prm_name>: <expression>. Note that the <prm_name> does not contain `"`."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EquationContext:
|
|
8
|
+
def __init__(self, swModel) -> None:
|
|
9
|
+
self.swModel = swModel
|
|
10
|
+
self.swEqnMgr = None
|
|
11
|
+
|
|
12
|
+
def __enter__(self):
|
|
13
|
+
# プロパティを退避
|
|
14
|
+
self.swEqnMgr = self.swModel.GetEquationMgr
|
|
15
|
+
self.buffer_aso = self.swEqnMgr.AutomaticSolveOrder
|
|
16
|
+
self.buffer_ar = self.swEqnMgr.AutomaticRebuild
|
|
17
|
+
self.swEqnMgr.AutomaticSolveOrder = False
|
|
18
|
+
self.swEqnMgr.AutomaticRebuild = False
|
|
19
|
+
return self.swEqnMgr
|
|
20
|
+
|
|
21
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
22
|
+
# プロパティをもとに戻す
|
|
23
|
+
assert self.swEqnMgr is not None
|
|
24
|
+
self.swEqnMgr.AutomaticSolveOrder = self.buffer_aso
|
|
25
|
+
self.swEqnMgr.AutomaticRebuild = self.buffer_ar
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EditPartContext:
|
|
29
|
+
def __init__(self, swModel, component) -> None:
|
|
30
|
+
self.swModel = swModel
|
|
31
|
+
self.component = component
|
|
32
|
+
|
|
33
|
+
def __enter__(self):
|
|
34
|
+
swSelMgr = self.swModel.SelectionManager
|
|
35
|
+
swSelData = swSelMgr.CreateSelectData
|
|
36
|
+
swSelMgr.AddSelectionListObject(self.component, swSelData)
|
|
37
|
+
# self.swModel.EditPart() # 対象がアセンブリの場合動作しない
|
|
38
|
+
self.swModel.AssemblyPartToggle() # Obsolete だが代わりにこれを使う
|
|
39
|
+
|
|
40
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
41
|
+
self.swModel.EditAssembly()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def is_assembly(swModel_or_name):
|
|
45
|
+
if isinstance(swModel_or_name, str):
|
|
46
|
+
return swModel_or_name.lower().endswith('.sldasm')
|
|
47
|
+
else:
|
|
48
|
+
return swModel_or_name.GetPathName.lower().endswith('.sldasm')
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _iter_parts(swModel):
|
|
52
|
+
components = swModel.GetComponents(
|
|
53
|
+
False # TopOnly
|
|
54
|
+
)
|
|
55
|
+
return components
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Used by pyfemtet-opt-gui
|
|
59
|
+
class SolidworksVariableManager:
|
|
60
|
+
|
|
61
|
+
def __init__(self, logger=None):
|
|
62
|
+
# Used by pyfemtet-opt-gui
|
|
63
|
+
self.updated_objects = set()
|
|
64
|
+
"""Updated variable names, sldprt file paths and linked .txt equation file paths."""
|
|
65
|
+
if logger is None:
|
|
66
|
+
from logging import getLogger
|
|
67
|
+
logger = getLogger('solidworks_variable_manager')
|
|
68
|
+
self.logger = logger
|
|
69
|
+
|
|
70
|
+
# Used by pyfemtet-opt-gui
|
|
71
|
+
def update_global_variables_recourse(self, swModel, x: SWVariables):
|
|
72
|
+
# まず自身のパラメータを更新
|
|
73
|
+
self.logger.debug(f'Processing `{swModel.GetPathName}`')
|
|
74
|
+
self._update_global_variables_core(swModel, x)
|
|
75
|
+
|
|
76
|
+
# アセンブリならば、構成部品のパラメータを更新
|
|
77
|
+
if is_assembly(swModel):
|
|
78
|
+
components = _iter_parts(swModel)
|
|
79
|
+
for component in components:
|
|
80
|
+
swPartModel = component.GetModelDoc2
|
|
81
|
+
self.logger.debug(f'Checking `{swPartModel.GetPathName}`')
|
|
82
|
+
if swPartModel.GetPathName.lower() not in self.updated_objects:
|
|
83
|
+
self.logger.debug(f'Processing `{swPartModel.GetPathName}`')
|
|
84
|
+
with EditPartContext(swModel, component):
|
|
85
|
+
self._update_global_variables_core(swPartModel, x)
|
|
86
|
+
self.updated_objects.add(swPartModel.GetPathName.lower())
|
|
87
|
+
|
|
88
|
+
def _update_global_variables_core(self, swModel, x: SWVariables):
|
|
89
|
+
with EquationContext(swModel) as swEqnMgr:
|
|
90
|
+
# txt にリンクされている場合は txt を更新
|
|
91
|
+
if swEqnMgr.LinkToFile:
|
|
92
|
+
self._update_global_variables_linked_txt(swEqnMgr, x)
|
|
93
|
+
self._update_global_variables_simple(swEqnMgr, x)
|
|
94
|
+
# noinspection PyStatementEffect
|
|
95
|
+
swEqnMgr.EvaluateAll
|
|
96
|
+
|
|
97
|
+
def _update_global_variables_linked_txt(self, swEqnMgr, x: SWVariables):
|
|
98
|
+
txt_path = swEqnMgr.FilePath
|
|
99
|
+
if txt_path in self.updated_objects:
|
|
100
|
+
return
|
|
101
|
+
with open(txt_path, 'r', encoding='utf_8_sig') as f:
|
|
102
|
+
equations = [line.strip() for line in f.readlines() if line.strip() != '']
|
|
103
|
+
for i, eq in enumerate(equations):
|
|
104
|
+
equations[i] = self._update_equation(eq, x)
|
|
105
|
+
with open(txt_path, 'w', encoding='utf_8_sig') as f:
|
|
106
|
+
f.writelines([eq + '\n' for eq in equations])
|
|
107
|
+
self.logger.debug(f'`{txt_path}` is updated.')
|
|
108
|
+
self.updated_objects.add(txt_path)
|
|
109
|
+
|
|
110
|
+
def _update_global_variables_simple(self, swEqnMgr, x: SWVariables):
|
|
111
|
+
nEquation = swEqnMgr.GetCount
|
|
112
|
+
|
|
113
|
+
# equation を列挙
|
|
114
|
+
self.logger.debug(f'{nEquation} equations detected.')
|
|
115
|
+
for i in range(nEquation):
|
|
116
|
+
# name, equation の取得
|
|
117
|
+
eq = swEqnMgr.Equation(i)
|
|
118
|
+
prm_name = self._get_left(eq)
|
|
119
|
+
# COM 経由なので必要な時以外は触らない
|
|
120
|
+
self.logger.debug(f'Checking `{prm_name}`')
|
|
121
|
+
if (prm_name in x) and (prm_name not in self.updated_objects):
|
|
122
|
+
self.logger.debug(f'Processing `{prm_name}`')
|
|
123
|
+
# 特定の Equation がテキストリンク有効か
|
|
124
|
+
# どうかを判定する術がないので、一旦更新する
|
|
125
|
+
new_eq = self._update_equation(eq, x)
|
|
126
|
+
swEqnMgr.Equation(i, new_eq)
|
|
127
|
+
# テキストリンクの場合、COM インスタンスに
|
|
128
|
+
# 更新された値が残ってしまうのでテキストを再読み込み
|
|
129
|
+
if swEqnMgr.LinkToFile:
|
|
130
|
+
# noinspection PyStatementEffect
|
|
131
|
+
swEqnMgr.UpdateValuesFromExternalEquationFile
|
|
132
|
+
self.updated_objects.add(prm_name)
|
|
133
|
+
|
|
134
|
+
def _update_equation(self, equation: str, x: SWVariables):
|
|
135
|
+
prm_name = self._get_left(equation)
|
|
136
|
+
if prm_name not in x:
|
|
137
|
+
return equation
|
|
138
|
+
new_eq = f'"{prm_name}" = {x[prm_name]}'
|
|
139
|
+
self.logger.debug(f'New eq.: `{new_eq}`')
|
|
140
|
+
return new_eq
|
|
141
|
+
|
|
142
|
+
@staticmethod
|
|
143
|
+
def _get_left(equation: str):
|
|
144
|
+
tmp = equation.split('=')
|
|
145
|
+
if len(tmp) == 0:
|
|
146
|
+
raise RuntimeError(f'Invalid solidworks equation: {equation} (no `=` contained)')
|
|
147
|
+
return tmp[0].strip('" ')
|
|
148
|
+
|
|
149
|
+
# Used by pyfemtet-opt-gui
|
|
150
|
+
@staticmethod
|
|
151
|
+
def get_equations_recourse(swModel, global_variables_only=False) -> list[str]:
|
|
152
|
+
out = list()
|
|
153
|
+
swEqnMgr = swModel.GetEquationMgr
|
|
154
|
+
for i in range(swEqnMgr.GetCount):
|
|
155
|
+
if global_variables_only and not swEqnMgr.GlobalVariable(i):
|
|
156
|
+
continue
|
|
157
|
+
eq = swEqnMgr.Equation(i)
|
|
158
|
+
out.append(eq)
|
|
159
|
+
if is_assembly(swModel):
|
|
160
|
+
components = _iter_parts(swModel)
|
|
161
|
+
for component in components:
|
|
162
|
+
swPartModel = component.GetModelDoc2
|
|
163
|
+
swEqnMgr = swPartModel.GetEquationMgr
|
|
164
|
+
for i in range(swEqnMgr.GetCount):
|
|
165
|
+
if global_variables_only and not swEqnMgr.GlobalVariable(i):
|
|
166
|
+
continue
|
|
167
|
+
eq = swEqnMgr.Equation(i)
|
|
168
|
+
out.append(eq)
|
|
169
|
+
return out
|
|
@@ -375,19 +375,20 @@ class FEMOpt:
|
|
|
375
375
|
def save_history():
|
|
376
376
|
while True:
|
|
377
377
|
sleep(2)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
378
|
+
if len(self.opt.history.get_df()) > 0:
|
|
379
|
+
try:
|
|
380
|
+
self.opt.history.save()
|
|
381
|
+
logger.debug('History saved!')
|
|
382
|
+
except PermissionError:
|
|
383
|
+
logger.error(
|
|
384
|
+
_('Cannot save history. '
|
|
385
|
+
'The most common reason is '
|
|
386
|
+
'that the csv is opened by '
|
|
387
|
+
'another program (such as Excel). '
|
|
388
|
+
'Please free {path} or lost the '
|
|
389
|
+
'optimization history.',
|
|
390
|
+
path=self.opt.history.path)
|
|
391
|
+
)
|
|
391
392
|
if entire_status.value >= WorkerStatus.finished:
|
|
392
393
|
break
|
|
393
394
|
logger.debug('History save thread finished!')
|
|
@@ -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
|
{pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_excel_interface/excel_interface.py
RENAMED
|
@@ -505,8 +505,10 @@ class ExcelInterface(COMInterface):
|
|
|
505
505
|
if not os.path.exists(xla_file_path):
|
|
506
506
|
raise FileNotFoundError(
|
|
507
507
|
_(
|
|
508
|
-
en_message='Femtet XLA file not found
|
|
509
|
-
|
|
508
|
+
en_message='Femtet XLA file ({xla_file_path}) not found. '
|
|
509
|
+
'Please run `Enable Macros` command.',
|
|
510
|
+
jp_message='Femtet XLA ファイル ({xla_file_path}) が見つかりません。'
|
|
511
|
+
'「マクロ機能の有効化」を実行してください。',
|
|
510
512
|
xla_file_path=xla_file_path
|
|
511
513
|
)
|
|
512
514
|
)
|
{pyfemtet-1.1.5 → pyfemtet-1.2.0}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py
RENAMED
|
@@ -7,13 +7,13 @@ import sys
|
|
|
7
7
|
import subprocess
|
|
8
8
|
from time import sleep
|
|
9
9
|
from contextlib import nullcontext
|
|
10
|
+
import importlib
|
|
10
11
|
|
|
11
12
|
# noinspection PyUnresolvedReferences
|
|
12
13
|
from pywintypes import com_error, error
|
|
13
14
|
# noinspection PyUnresolvedReferences
|
|
14
15
|
from pythoncom import CoInitialize, CoUninitialize
|
|
15
|
-
|
|
16
|
-
from win32com.client import constants
|
|
16
|
+
from win32com.client import constants, Dispatch
|
|
17
17
|
import win32con
|
|
18
18
|
import win32gui
|
|
19
19
|
|
|
@@ -353,6 +353,8 @@ class FemtetInterface(COMInterface):
|
|
|
353
353
|
it will not try existing another Femtet process.
|
|
354
354
|
|
|
355
355
|
"""
|
|
356
|
+
# noinspection PyGlobalUndefined
|
|
357
|
+
global constants
|
|
356
358
|
|
|
357
359
|
if connect_method == "new":
|
|
358
360
|
self._connect_new_femtet()
|
|
@@ -373,32 +375,39 @@ class FemtetInterface(COMInterface):
|
|
|
373
375
|
if not hasattr(constants, "STATIC_C"):
|
|
374
376
|
cmd = f"{sys.executable} -m win32com.client.makepy FemtetMacro"
|
|
375
377
|
subprocess.run(cmd, shell=True)
|
|
378
|
+
sleep(1)
|
|
379
|
+
|
|
380
|
+
import win32com.client
|
|
381
|
+
importlib.reload(win32com.client)
|
|
382
|
+
from win32com.client import Dispatch, constants
|
|
383
|
+
Dispatch('FemtetMacro.Femtet')
|
|
384
|
+
|
|
385
|
+
if not hasattr(constants, "STATIC_C"):
|
|
386
|
+
message = _(
|
|
387
|
+
en_message='It was detected that the configuration of '
|
|
388
|
+
'Femtet python macro constants has not been '
|
|
389
|
+
'completed. The configuration was done '
|
|
390
|
+
'automatically '
|
|
391
|
+
'(python -m win32com.client.makepy FemtetMacro). '
|
|
392
|
+
'Please restart the program. '
|
|
393
|
+
'If the error persists, please run '
|
|
394
|
+
'"py -m win32com.client.makepy FemtetMacro" '
|
|
395
|
+
'or "python -m win32com.client.makepy FemtetMacro" '
|
|
396
|
+
'on the command prompt.',
|
|
397
|
+
jp_message='Femtet Pythonマクロ定数の設定が完了していない'
|
|
398
|
+
'ことが検出されました。設定は自動で行われました'
|
|
399
|
+
'(py -m win32com.client.makepy FemtetMacro)。 '
|
|
400
|
+
'プログラムを再起動してください。'
|
|
401
|
+
'エラーが解消されない場合は、'
|
|
402
|
+
'"py -m win32com.client.makepy FemtetMacro" か '
|
|
403
|
+
'"python -m win32com.client.makepy FemtetMacro" '
|
|
404
|
+
'コマンドをコマンドプロンプトで実行してください。'
|
|
405
|
+
)
|
|
376
406
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
'automatically '
|
|
382
|
-
'(python -m win32com.client.makepy FemtetMacro). '
|
|
383
|
-
'Please restart the program. '
|
|
384
|
-
'If the error persists, please run '
|
|
385
|
-
'"py -m win32com.client.makepy FemtetMacro" '
|
|
386
|
-
'or "python -m win32com.client.makepy FemtetMacro" '
|
|
387
|
-
'on the command prompt.',
|
|
388
|
-
jp_message='Femtet Pythonマクロ定数の設定が完了していない'
|
|
389
|
-
'ことが検出されました。設定は自動で行われました'
|
|
390
|
-
'(py -m win32com.client.makepy FemtetMacro)。 '
|
|
391
|
-
'プログラムを再起動してください。'
|
|
392
|
-
'エラーが解消されない場合は、'
|
|
393
|
-
'"py -m win32com.client.makepy FemtetMacro" か '
|
|
394
|
-
'"python -m win32com.client.makepy FemtetMacro" '
|
|
395
|
-
'コマンドをコマンドプロンプトで実行してください。'
|
|
396
|
-
)
|
|
397
|
-
|
|
398
|
-
logger.error("================")
|
|
399
|
-
logger.error(message)
|
|
400
|
-
logger.error("================")
|
|
401
|
-
raise RuntimeError(message)
|
|
407
|
+
logger.error("================")
|
|
408
|
+
logger.error(message)
|
|
409
|
+
logger.error("================")
|
|
410
|
+
raise RuntimeError(message)
|
|
402
411
|
|
|
403
412
|
if self.Femtet is None:
|
|
404
413
|
raise RuntimeError(_(
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from time import sleep
|
|
4
|
-
from typing import TYPE_CHECKING
|
|
5
|
-
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
6
5
|
import os
|
|
7
|
-
import re
|
|
8
6
|
|
|
9
|
-
from win32com.client import
|
|
10
|
-
|
|
11
|
-
from pythoncom import CoInitialize, CoUninitialize, com_error
|
|
7
|
+
from win32com.client import Dispatch
|
|
8
|
+
from pythoncom import com_error, CoInitialize
|
|
12
9
|
|
|
13
10
|
from pyfemtet._util.dask_util import *
|
|
14
11
|
from pyfemtet.opt.exceptions import *
|
|
@@ -17,12 +14,13 @@ from pyfemtet._i18n import _
|
|
|
17
14
|
from pyfemtet.opt.problem.problem import *
|
|
18
15
|
from pyfemtet.logger import get_module_logger
|
|
19
16
|
|
|
17
|
+
from pyfemtet._util.solidworks_variable import SolidworksVariableManager, is_assembly, SWVariables
|
|
18
|
+
|
|
20
19
|
if TYPE_CHECKING:
|
|
21
20
|
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
22
21
|
|
|
23
|
-
|
|
24
22
|
logger = get_module_logger('opt.interface', False)
|
|
25
|
-
|
|
23
|
+
asm_logger = get_module_logger('opt.interface.sldasm', False)
|
|
26
24
|
|
|
27
25
|
# 定数の宣言
|
|
28
26
|
swThisConfiguration = 1 # https://help.solidworks.com/2023/english/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swInConfigurationOpts_e.html
|
|
@@ -33,6 +31,7 @@ swSaveAsOptions_Copy = 2 #
|
|
|
33
31
|
swSaveAsOptions_Silent = 1 # https://help.solidworks.com/2021/english/api/swconst/solidworks.interop.swconst~solidworks.interop.swconst.swsaveasoptions_e.html
|
|
34
32
|
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
|
|
35
33
|
swDocPART = 1 # https://help.solidworks.com/2023/english/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swDocumentTypes_e.html
|
|
34
|
+
swDocASSEMBLY = 2
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
class FileNotOpenedError(Exception):
|
|
@@ -63,7 +62,7 @@ class SolidworksInterface(COMInterface):
|
|
|
63
62
|
AssertionError: If the specified part file does not exist.
|
|
64
63
|
"""
|
|
65
64
|
|
|
66
|
-
swApp:
|
|
65
|
+
swApp: Any
|
|
67
66
|
com_members = {'swApp': 'SLDWORKS.Application'}
|
|
68
67
|
_access_sw_lock_name = 'access_sw'
|
|
69
68
|
|
|
@@ -77,7 +76,8 @@ class SolidworksInterface(COMInterface):
|
|
|
77
76
|
self.quit_solidworks_on_terminate = close_solidworks_on_terminate
|
|
78
77
|
self.solidworks_visible = visible
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
if not os.path.isfile(self.sldprt_path):
|
|
80
|
+
raise FileNotFoundError(self.sldprt_path)
|
|
81
81
|
self._original_sldprt_path = self.sldprt_path
|
|
82
82
|
|
|
83
83
|
def connect_sw(self):
|
|
@@ -86,9 +86,9 @@ class SolidworksInterface(COMInterface):
|
|
|
86
86
|
jp_message='Solidworks に接続しています...'
|
|
87
87
|
))
|
|
88
88
|
try:
|
|
89
|
-
self.swApp =
|
|
89
|
+
self.swApp = Dispatch('SLDWORKS.Application')
|
|
90
90
|
except com_error:
|
|
91
|
-
raise
|
|
91
|
+
raise RuntimeError(_(
|
|
92
92
|
en_message='Failed to instantiate Solidworks. '
|
|
93
93
|
'Please check installation and enabling macro.',
|
|
94
94
|
jp_message='Solidworks のインスタンス化に失敗しました。'
|
|
@@ -97,18 +97,32 @@ class SolidworksInterface(COMInterface):
|
|
|
97
97
|
self.swApp.Visible = self.solidworks_visible
|
|
98
98
|
|
|
99
99
|
def _setup_before_parallel(self, scheduler_address=None):
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if not is_assembly(self.sldprt_path):
|
|
101
|
+
self._distribute_files([self.sldprt_path], scheduler_address)
|
|
102
|
+
|
|
103
|
+
def _setup_after_parallel(self, opt: AbstractOptimizer):
|
|
104
|
+
|
|
105
|
+
# validation
|
|
106
|
+
if is_assembly(self.sldprt_path) and get_worker() is not None:
|
|
107
|
+
# 現在の仕様だと sldprt_path だけが
|
|
108
|
+
# worker_space に保存される。
|
|
109
|
+
# 並列処理に対応するためには
|
|
110
|
+
# すべてのファイルを distribute したうえで
|
|
111
|
+
# 構成部品の置換を実行する必要がある。
|
|
112
|
+
raise RuntimeError(_(
|
|
113
|
+
en_message='Parallel processing is not supported when handling assembly parts with SolidworksInterface.',
|
|
114
|
+
jp_message='SolidworksInterfaceでアセンブリパーツを対象とする場合、並列処理はサポートされていません。'
|
|
115
|
+
))
|
|
103
116
|
|
|
104
|
-
|
|
105
|
-
|
|
117
|
+
if not is_assembly(self.sldprt_path):
|
|
118
|
+
# get suffix
|
|
119
|
+
suffix = self._get_file_suffix(opt)
|
|
106
120
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
# rename and get worker path
|
|
122
|
+
self.sldprt_path = self._rename_and_get_path_on_worker_space(
|
|
123
|
+
self._original_sldprt_path,
|
|
124
|
+
suffix,
|
|
125
|
+
)
|
|
112
126
|
|
|
113
127
|
# connect solidworks
|
|
114
128
|
CoInitialize()
|
|
@@ -116,10 +130,13 @@ class SolidworksInterface(COMInterface):
|
|
|
116
130
|
self.connect_sw()
|
|
117
131
|
|
|
118
132
|
# open it
|
|
119
|
-
|
|
133
|
+
if is_assembly(self.sldprt_path):
|
|
134
|
+
self.swApp.OpenDoc(self.sldprt_path, swDocASSEMBLY)
|
|
135
|
+
else:
|
|
136
|
+
self.swApp.OpenDoc(self.sldprt_path, swDocPART)
|
|
120
137
|
|
|
121
138
|
@property
|
|
122
|
-
def swModel(self)
|
|
139
|
+
def swModel(self):
|
|
123
140
|
return _get_model_by_basename(self.swApp, os.path.basename(self.sldprt_path))
|
|
124
141
|
|
|
125
142
|
def update(self) -> None:
|
|
@@ -131,54 +148,25 @@ class SolidworksInterface(COMInterface):
|
|
|
131
148
|
|
|
132
149
|
# sw はプロセスが一つなので Lock
|
|
133
150
|
with Lock(self._access_sw_lock_name):
|
|
134
|
-
|
|
135
151
|
sleep(0.2)
|
|
136
|
-
|
|
137
|
-
# ===== model を取得 =====
|
|
138
152
|
swModel = self.swModel
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
swEqnMgr.AutomaticSolveOrder = False
|
|
148
|
-
swEqnMgr.AutomaticRebuild = False
|
|
149
|
-
|
|
150
|
-
# 値を更新
|
|
151
|
-
for i in range(nEquation):
|
|
152
|
-
# name, equation の取得
|
|
153
|
-
eq = swEqnMgr.Equation(i)
|
|
154
|
-
prm_name = _get_name_from_equation(eq)
|
|
155
|
-
# 対象なら処理
|
|
156
|
-
if prm_name in self.current_prm_values:
|
|
157
|
-
prm = self.current_prm_values[prm_name]
|
|
158
|
-
right = str(prm.value) + prm.properties.get('unit', '')
|
|
159
|
-
new_equation = f'"{prm_name}" = {right}'
|
|
160
|
-
swEqnMgr.Equation(i, new_equation)
|
|
161
|
-
|
|
162
|
-
# 式の計算
|
|
163
|
-
# noinspection PyStatementEffect
|
|
164
|
-
swEqnMgr.EvaluateAll # always returns -1
|
|
165
|
-
|
|
166
|
-
# プロパティをもとに戻す
|
|
167
|
-
swEqnMgr.AutomaticSolveOrder = buffer_aso
|
|
168
|
-
swEqnMgr.AutomaticRebuild = buffer_ar
|
|
153
|
+
mgr = SolidworksVariableManager(asm_logger)
|
|
154
|
+
sw_variables: SWVariables = {
|
|
155
|
+
name: str(param.value) + param.properties.get('unit', '')
|
|
156
|
+
for name, param in
|
|
157
|
+
self.current_prm_values.items()
|
|
158
|
+
if isinstance(param.value, float | int)
|
|
159
|
+
}
|
|
160
|
+
mgr.update_global_variables_recourse(swModel, sw_variables)
|
|
169
161
|
|
|
170
162
|
def update_model(self):
|
|
171
163
|
"""Update .sldprt"""
|
|
172
164
|
|
|
173
165
|
# sw はプロセスが一つなので Lock
|
|
174
166
|
with Lock(self._access_sw_lock_name):
|
|
175
|
-
|
|
176
167
|
sleep(0.2)
|
|
177
168
|
|
|
178
|
-
# ===== model を取得 =====
|
|
179
169
|
swModel = self.swModel
|
|
180
|
-
|
|
181
|
-
# モデル再構築
|
|
182
170
|
result = swModel.EditRebuild3 # モデル再構築
|
|
183
171
|
if not result:
|
|
184
172
|
raise ModelError(_(
|
|
@@ -218,12 +206,3 @@ def _get_model_by_basename(swApp, basename):
|
|
|
218
206
|
if swModel is None:
|
|
219
207
|
raise FileNotOpenedError(f'Model {basename} is not opened.')
|
|
220
208
|
return swModel
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def _get_name_from_equation(equation: str):
|
|
224
|
-
pattern = r'^\s*"(.+?)"\s*$'
|
|
225
|
-
matched = re.match(pattern, equation.split('=')[0])
|
|
226
|
-
if matched:
|
|
227
|
-
return matched.group(1)
|
|
228
|
-
else:
|
|
229
|
-
return None
|
|
@@ -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)
|