pyfemtet 0.9.5__py3-none-any.whl → 1.0.0b0__py3-none-any.whl
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/__init__.py +6 -1
- pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
- pyfemtet/_i18n/2. build_mo.bat +5 -0
- pyfemtet/_i18n/__init__.py +4 -0
- pyfemtet/_i18n/babel.cfg +2 -0
- pyfemtet/_i18n/i18n.py +37 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
- pyfemtet/_i18n/locales/messages.pot +987 -0
- pyfemtet/{_message → _i18n}/messages.py +128 -41
- pyfemtet/_util/closing.py +19 -0
- pyfemtet/_util/dask_util.py +89 -7
- pyfemtet/_util/df_util.py +29 -0
- pyfemtet/_util/excel_macro_util.py +8 -3
- pyfemtet/_util/excel_parse_util.py +43 -23
- pyfemtet/_util/femtet_access_inspection.py +120 -0
- pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
- pyfemtet/_util/femtet_exit.py +105 -0
- pyfemtet/_util/femtet_version.py +20 -0
- pyfemtet/_util/helper.py +94 -0
- pyfemtet/_util/process_util.py +107 -0
- pyfemtet/_util/str_enum.py +44 -0
- pyfemtet/core.py +15 -47
- pyfemtet/dispatch_extensions/__init__.py +8 -11
- pyfemtet/dispatch_extensions/_impl.py +42 -198
- pyfemtet/logger/__init__.py +8 -1
- pyfemtet/logger/_impl.py +5 -6
- pyfemtet/opt/__init__.py +3 -17
- pyfemtet/opt/exceptions.py +45 -0
- pyfemtet/opt/femopt.py +608 -0
- pyfemtet/opt/history/__init__.py +11 -0
- pyfemtet/opt/history/_history.py +1404 -0
- pyfemtet/opt/history/_hypervolume.py +169 -0
- pyfemtet/opt/history/_optimality.py +79 -0
- pyfemtet/opt/interface/__init__.py +17 -24
- pyfemtet/opt/interface/_base_interface.py +222 -0
- pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
- pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- pyfemtet/opt/interface/_excel_interface/excel_interface.py +999 -0
- pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
- pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
- pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +505 -349
- pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
- pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
- pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +122 -0
- pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +206 -0
- pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
- pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
- pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
- pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
- pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
- pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- pyfemtet/opt/meta_script/__main__.py +58 -36
- pyfemtet/opt/optimizer/__init__.py +7 -9
- pyfemtet/opt/optimizer/_base_optimizer.py +885 -0
- pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +678 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
- pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
- pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +364 -0
- pyfemtet/opt/prediction/__init__.py +7 -0
- pyfemtet/opt/prediction/_botorch_utils.py +133 -0
- pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
- pyfemtet/opt/prediction/_helper.py +155 -0
- pyfemtet/opt/prediction/_model.py +118 -0
- pyfemtet/opt/problem/problem.py +304 -0
- pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
- pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
- pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
- pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
- pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
- pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
- pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
- pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
- pyfemtet/opt/worker_status.py +120 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/METADATA +23 -24
- pyfemtet-1.0.0b0.dist-info/RECORD +172 -0
- pyfemtet-1.0.0b0.dist-info/entry_points.txt +3 -0
- pyfemtet/_femtet_config_util/exit.py +0 -59
- pyfemtet/_message/1. make_pot.bat +0 -11
- pyfemtet/_message/2. make_mo.bat +0 -6
- pyfemtet/_message/__init__.py +0 -5
- pyfemtet/_message/babel.cfg +0 -2
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
- pyfemtet/_message/locales/messages.pot +0 -551
- pyfemtet/_warning.py +0 -87
- pyfemtet/brep/_impl.py +0 -18
- pyfemtet/opt/_femopt.py +0 -1007
- pyfemtet/opt/_femopt_core.py +0 -1169
- pyfemtet/opt/_test_utils/control_femtet.py +0 -39
- pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
- pyfemtet/opt/_test_utils/record_history.py +0 -130
- pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
- pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/interface/_base.py +0 -101
- pyfemtet/opt/interface/_excel_interface.py +0 -984
- pyfemtet/opt/interface/_femtet_excel.py +0 -141
- pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
- pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
- pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
- pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
- pyfemtet/opt/interface/_surrogate/_base.py +0 -129
- pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
- pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
- pyfemtet/opt/interface/_surrogate_excel.py +0 -102
- pyfemtet/opt/optimizer/_base.py +0 -376
- pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
- pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
- pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
- pyfemtet/opt/optimizer/_scipy.py +0 -159
- pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
- pyfemtet/opt/optimizer/parameter.py +0 -113
- pyfemtet/opt/prediction/_base.py +0 -61
- pyfemtet/opt/prediction/single_task_gp.py +0 -119
- pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
- pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
- pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
- pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
- pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
- pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
- pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
- pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
- pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
- pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
- pyfemtet-0.9.5.dist-info/RECORD +0 -158
- pyfemtet-0.9.5.dist-info/entry_points.txt +0 -3
- /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
- /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
- /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
- /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
- /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
- /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import json
|
|
7
|
+
import subprocess
|
|
8
|
+
|
|
9
|
+
# noinspection PyUnresolvedReferences
|
|
10
|
+
from pywintypes import com_error
|
|
11
|
+
|
|
12
|
+
from pyfemtet._i18n import Msg, _
|
|
13
|
+
from pyfemtet.opt.interface._base_interface import AbstractFEMInterface
|
|
14
|
+
from pyfemtet.opt.interface._femtet_interface import FemtetInterface
|
|
15
|
+
from pyfemtet.opt.exceptions import *
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
here, me = os.path.split(__file__)
|
|
22
|
+
JOURNAL_PATH = os.path.abspath(os.path.join(here, 'update_model.py'))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# NX 単体で Interface 化する予定がないのでモジュール分割しない
|
|
26
|
+
class _NXInterface(AbstractFEMInterface):
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
prt_path: str,
|
|
31
|
+
export_curves: bool or None = None,
|
|
32
|
+
export_surfaces: bool or None = None,
|
|
33
|
+
export_solids: bool or None = None,
|
|
34
|
+
export_flattened_assembly: bool or None = None,
|
|
35
|
+
):
|
|
36
|
+
# check NX installation
|
|
37
|
+
self.run_journal_path = os.path.join(os.environ.get('UGII_BASE_DIR'), 'NXBIN', 'run_journal.exe')
|
|
38
|
+
if not os.path.isfile(self.run_journal_path):
|
|
39
|
+
raise FileNotFoundError(_(
|
|
40
|
+
en_message='`run_journal.exe` is not found. '
|
|
41
|
+
'Please check:\n'
|
|
42
|
+
'- NX is installed.\n'
|
|
43
|
+
'- The environment variable `UGII_BASE_DIR` is set.\n'
|
|
44
|
+
'- `<UGII_BASE_DIR>\\NXBIN\\run_journal.exe` exists.\n',
|
|
45
|
+
jp_message='「run_journal.exe」 が見つかりませんでした。'
|
|
46
|
+
'以下のことを確認してください。\n'
|
|
47
|
+
'- NX がインストールされている\n'
|
|
48
|
+
'- 環境変数 UGII_BASE_DIR が設定されている\n'
|
|
49
|
+
'- <UGII_BASE_DIR>\\NXBIN\\run_journal.exe が存在する'
|
|
50
|
+
))
|
|
51
|
+
|
|
52
|
+
self.prt_path = os.path.abspath(prt_path)
|
|
53
|
+
assert os.path.isfile(self.prt_path)
|
|
54
|
+
self._prt_path = self.prt_path
|
|
55
|
+
self.export_curves = export_curves
|
|
56
|
+
self.export_surfaces = export_surfaces
|
|
57
|
+
self.export_solids = export_solids
|
|
58
|
+
self.export_flattened_assembly = export_flattened_assembly
|
|
59
|
+
|
|
60
|
+
def _setup_before_parallel(self) -> None:
|
|
61
|
+
self._distribute_files([self.prt_path])
|
|
62
|
+
|
|
63
|
+
def _setup_after_parallel(self, opt: AbstractOptimizer = None) -> None:
|
|
64
|
+
# get suffix
|
|
65
|
+
suffix = self._get_worker_index_from_optimizer(opt)
|
|
66
|
+
|
|
67
|
+
# rename and get worker path
|
|
68
|
+
self.prt_path = self._rename_and_get_path_on_worker_space(
|
|
69
|
+
self._prt_path,
|
|
70
|
+
suffix,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
def _export_xt(self, xt_path) -> None:
|
|
74
|
+
"""Update .x_t"""
|
|
75
|
+
|
|
76
|
+
# 前のが存在するならば消しておく
|
|
77
|
+
if os.path.isfile(xt_path):
|
|
78
|
+
os.remove(xt_path)
|
|
79
|
+
|
|
80
|
+
# 変数の json 文字列を作る
|
|
81
|
+
str_json = json.dumps(self.current_prm_values)
|
|
82
|
+
|
|
83
|
+
# create dumped json of export settings
|
|
84
|
+
tmp_dict = dict(
|
|
85
|
+
include_curves=self.export_curves,
|
|
86
|
+
include_surfaces=self.export_surfaces,
|
|
87
|
+
include_solids=self.export_solids,
|
|
88
|
+
flatten_assembly=self.export_flattened_assembly,
|
|
89
|
+
)
|
|
90
|
+
dumped_json_export_settings = json.dumps(tmp_dict)
|
|
91
|
+
|
|
92
|
+
# NX journal を使ってモデルを編集する
|
|
93
|
+
env = os.environ.copy()
|
|
94
|
+
subprocess.run(
|
|
95
|
+
[
|
|
96
|
+
self.run_journal_path, # run_journal.exe
|
|
97
|
+
JOURNAL_PATH, # update_model.py
|
|
98
|
+
'-args',
|
|
99
|
+
self.prt_path,
|
|
100
|
+
str_json,
|
|
101
|
+
xt_path,
|
|
102
|
+
dumped_json_export_settings,
|
|
103
|
+
],
|
|
104
|
+
env=env,
|
|
105
|
+
shell=True,
|
|
106
|
+
cwd=os.path.dirname(self.prt_path)
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# この時点で x_t ファイルがなければ NX がモデル更新に失敗しているはず
|
|
110
|
+
if not os.path.isfile(xt_path):
|
|
111
|
+
raise ModelError
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class FemtetWithNXInterface(FemtetInterface, _NXInterface):
|
|
115
|
+
"""Control Femtet and NX.
|
|
116
|
+
|
|
117
|
+
Using this class, you can import CAD files created
|
|
118
|
+
in NX through the Parasolid format into a
|
|
119
|
+
Femtet project. It allows you to pass design
|
|
120
|
+
variables to NX, update the model, and
|
|
121
|
+
perform analysis using the updated model in Femtet.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
prt_path (str):
|
|
125
|
+
The path to .prt file containing the
|
|
126
|
+
CAD data from which the import is made.
|
|
127
|
+
|
|
128
|
+
export_curves(bool or None, optional):
|
|
129
|
+
Defaults to None.
|
|
130
|
+
export_surfaces(bool or None, optional):
|
|
131
|
+
Defaults to None.
|
|
132
|
+
export_solids(bool or None, optional):
|
|
133
|
+
Defaults to None.
|
|
134
|
+
export_flattened_assembly(bool or None, optional):
|
|
135
|
+
Defaults to None.
|
|
136
|
+
|
|
137
|
+
Notes:
|
|
138
|
+
```export_*``` arguments sets
|
|
139
|
+
parasolid export setting of NX.
|
|
140
|
+
If None, PyFemtet does not change
|
|
141
|
+
the current setting of NX.
|
|
142
|
+
|
|
143
|
+
It is recommended not to change these values
|
|
144
|
+
from the settings used when exporting the
|
|
145
|
+
Parasolid that was imported into Femtet.
|
|
146
|
+
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
def __init__(
|
|
150
|
+
self,
|
|
151
|
+
prt_path: str,
|
|
152
|
+
femprj_path: str = None,
|
|
153
|
+
model_name: str = None,
|
|
154
|
+
connect_method: str = "auto", # dask worker では __init__ の中で 'new' にするので super() の引数にしない。(しても意味がない)
|
|
155
|
+
save_pdt: str = "all", # 'all' or None
|
|
156
|
+
strictly_pid_specify: bool = True, # dask worker では True にしたいので super() の引数にしない。
|
|
157
|
+
allow_without_project: bool = False, # main でのみ True を許容したいので super() の引数にしない。
|
|
158
|
+
open_result_with_gui: bool = True,
|
|
159
|
+
parametric_output_indexes_use_as_objective: dict[int, str | float] = None,
|
|
160
|
+
always_open_copy=False,
|
|
161
|
+
export_curves: bool or None = None,
|
|
162
|
+
export_surfaces: bool or None = None,
|
|
163
|
+
export_solids: bool or None = None,
|
|
164
|
+
export_flattened_assembly: bool or None = None,
|
|
165
|
+
):
|
|
166
|
+
|
|
167
|
+
FemtetInterface.__init__(
|
|
168
|
+
self,
|
|
169
|
+
femprj_path=femprj_path,
|
|
170
|
+
model_name=model_name,
|
|
171
|
+
connect_method=connect_method,
|
|
172
|
+
save_pdt=save_pdt,
|
|
173
|
+
strictly_pid_specify=strictly_pid_specify,
|
|
174
|
+
allow_without_project=allow_without_project,
|
|
175
|
+
open_result_with_gui=open_result_with_gui,
|
|
176
|
+
parametric_output_indexes_use_as_objective=parametric_output_indexes_use_as_objective,
|
|
177
|
+
always_open_copy=always_open_copy,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
_NXInterface.__init__(
|
|
181
|
+
self,
|
|
182
|
+
prt_path=prt_path,
|
|
183
|
+
export_curves=export_curves,
|
|
184
|
+
export_surfaces=export_surfaces,
|
|
185
|
+
export_solids=export_solids,
|
|
186
|
+
export_flattened_assembly=export_flattened_assembly,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def _setup_before_parallel(self):
|
|
190
|
+
FemtetInterface._setup_before_parallel(self)
|
|
191
|
+
_NXInterface._setup_before_parallel(self)
|
|
192
|
+
|
|
193
|
+
def _setup_after_parallel(self, opt: AbstractOptimizer = None):
|
|
194
|
+
FemtetInterface._setup_after_parallel(self, opt)
|
|
195
|
+
_NXInterface._setup_after_parallel(self, opt)
|
|
196
|
+
|
|
197
|
+
def update_model(self):
|
|
198
|
+
|
|
199
|
+
# 競合しないよう保存先を temp にしておく
|
|
200
|
+
worker_space = self._get_worker_space()
|
|
201
|
+
xt_path = os.path.join(worker_space, 'temp.x_t')
|
|
202
|
+
|
|
203
|
+
# export parasolid
|
|
204
|
+
self._export_xt(xt_path)
|
|
205
|
+
|
|
206
|
+
# LastXTPath を更新する
|
|
207
|
+
try:
|
|
208
|
+
self.Femtet.Gaudi.LastXTPath = xt_path
|
|
209
|
+
except (KeyError, AttributeError, com_error):
|
|
210
|
+
raise RuntimeError('This feature is available from Femtet version 2023.2. Please update Femtet.')
|
|
211
|
+
|
|
212
|
+
# update_parameter で変数は更新されているので
|
|
213
|
+
# ここでモデルを完全に再構築できる
|
|
214
|
+
FemtetInterface.update_model(self)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def _debug_1():
|
|
218
|
+
|
|
219
|
+
fem = _NXInterface(
|
|
220
|
+
prt_path=os.path.join(os.path.dirname(__file__), 'model1.prt'),
|
|
221
|
+
export_solids=True,
|
|
222
|
+
)
|
|
223
|
+
fem._setup_before_parallel()
|
|
224
|
+
fem._setup_after_parallel()
|
|
225
|
+
fem.update_parameter({'x': 20})
|
|
226
|
+
fem._export_xt(os.path.join(os.path.dirname(__file__), 'model1.x_t'))
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
if __name__ == '__main__':
|
|
230
|
+
_debug_1()
|
|
Binary file
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
**ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz**************************
|
|
2
|
+
**PARASOLID !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~0123456789**************************
|
|
3
|
+
**PART1;
|
|
4
|
+
MC=x64/Windows NT;
|
|
5
|
+
MC_MODEL=genuineintel family 6 model 7 stepping 2, 12th gen intel(r) core(tm) i7-12700;
|
|
6
|
+
MC_ID=m6cow;
|
|
7
|
+
OS=windows nt (x64);
|
|
8
|
+
OS_RELEASE=6.3 windows 10 pro (build 19045) ;
|
|
9
|
+
FRU=mdc_ugii_v7.0_djl_can_vrh;
|
|
10
|
+
APPL=unigraphics;
|
|
11
|
+
SITE=unknown;
|
|
12
|
+
USER=mm11592;
|
|
13
|
+
FORMAT=text;
|
|
14
|
+
GUISE=transmit;
|
|
15
|
+
KEY=model1;
|
|
16
|
+
FILE=E:\pyfemtet\pyfemtet\pyfemtet\opt\interface\nx_interface\model1.x_t;
|
|
17
|
+
DATE=25-mar-2025;
|
|
18
|
+
**PART2;
|
|
19
|
+
SCH=SCH_3400176_34001;
|
|
20
|
+
USFLD_SIZE=0;
|
|
21
|
+
**PART3;
|
|
22
|
+
**END_OF_HEADER*****************************************************************
|
|
23
|
+
T51 : TRANSMIT FILE created by modeller version 340017623 SCH_3400176_34001_1300
|
|
24
|
+
6231 0 12 36 CCCI7 lattice222 0 CCCI4 mesh1006 0 I8 polyline1008 0 CCCCCCCDI5 ow
|
|
25
|
+
ner1040 0 CCCI16 boundary_lattice222 0 CCCI13 boundary_mesh1006 0 I17 boundary_p
|
|
26
|
+
olyline1008 0 CCCA16 index_map_offset0 0 1 dA9 index_map82 0 A17 node_id_index_m
|
|
27
|
+
ap82 0 A20 schema_embedding_map82 0 A5 child12 0 A14 lowest_node_id0 0 1 dA16 me
|
|
28
|
+
sh_offset_data206 0 Z1 136 2 3 0 0 0 0 0 0 0 1e3 1e-8 0 0 0 1 0 1 1 4 0 5 6 7 0
|
|
29
|
+
0 8 9 10 0 0 0 0 0 0 0 81 255 1 2 136 11 1 12 0 0 0 13 70 11 CI9 list_type0 0 1
|
|
30
|
+
uI10 notransmit0 0 1 lCCCDCCDI12 finger_index0 0 1 dI12 finger_block1012 0 CZ3
|
|
31
|
+
0 4 T1 0 0 4 20 1 14 14 13 255 4 91 0 1 0 15 0 0 16 0 50 255 5 86 0 15 17 0 0 +
|
|
32
|
+
0 .01 .01 1 0 0 0 0 -1 30 255 6 90 0 18 19 0 0 +0 .01 .01 0 0 -1 29 255 7 67 0 2
|
|
33
|
+
0 21 0 .02 .01 0 19 9 CCCCCCI5 frame230 0 CA5 owner12 0 Z8 1 0 1 16 0 22 0 V0 16
|
|
34
|
+
255 9 73 23 ?24 0 25 19 0 0 1 18 255 10 15 0 26 0 27 28 ?1 17 255 26 0 29 30 31
|
|
35
|
+
10 32 33 0 34 +18 27 10 0 31 10 35 36 ?1 29 28 17 0 10 36 37 .02 .01 .01 29 36
|
|
36
|
+
12 0 27 38 28 .02 0 .01 29 37 70 0 39 28 40 0 .01 0 18 39 60 0 41 42 0 37 ?1 29
|
|
37
|
+
40 69 0 42 37 21 0 0 0 18 42 58 0 43 44 39 40 ?1 29 21 68 0 44 40 7 .02 0 0 18
|
|
38
|
+
44 56 0 45 20 42 21 ?1 17 45 0 46 47 24 44 43 48 0 49 +18 20 54 0 50 51 44 7 ?1
|
|
39
|
+
17 50 0 52 34 49 20 53 54 0 55 +18 51 2 0 30 35 20 56 ?1 17 30 0 29 57 26 51 58
|
|
40
|
+
59 0 60 +18 35 5 0 61 27 51 38 ?1 29 56 4 0 51 0 38 0 .01 .01 29 38 7 0 35 56 3
|
|
41
|
+
6 0 0 .01 17 61 0 46 24 47 35 31 62 0 57 -15 255 46 79 0 45 63 0 17 24 0 46 45 6
|
|
42
|
+
1 42 64 9 0 65 +17 47 0 46 61 45 27 49 25 0 32 -17 31 0 29 26 57 27 61 62 0 47 +
|
|
43
|
+
16 62 11 66 ?31 33 67 68 0 0 1 17 57 0 29 31 30 35 69 67 0 64 +15 29 23 0 57 70
|
|
44
|
+
0 17 69 0 71 72 64 51 57 67 0 0 -16 67 6 73 ?57 62 74 75 0 0 1 17 64 0 71 69 65
|
|
45
|
+
35 24 9 0 0 -15 71 81 0 65 15 0 17 65 0 71 64 72 42 76 77 0 0 +17 72 0 71 65 69
|
|
46
|
+
39 60 18 0 76 +17 76 0 78 79 43 39 65 77 0 0 -16 77 52 80 ?65 48 0 81 0 0 1 81
|
|
47
|
+
1 80 115 82 77 0 0 23 73 83 16 48 50 84 ?45 54 77 85 0 0 1 30 81 66 0 77 86 85
|
|
48
|
+
0 +0 .01 0 0 -1 0 30 86 22 0 59 87 81 0 +.02 .01 .01 -1 0 0 30 85 65 0 48 81 88
|
|
49
|
+
0 +0 0 0 1 0 0 30 88 64 0 54 85 89 0 +.02 0 0 0 1 0 16 54 48 90 ?50 74 48 88 0
|
|
50
|
+
0 1 30 89 63 0 74 88 91 0 +.02 .01 0 -1 0 0 16 74 46 92 ?41 67 54 89 0 0 1 30 9
|
|
51
|
+
1 87 0 93 89 94 0 +.02 .01 .01 0 0 -1 16 93 71 95 ?55 25 18 91 0 0 1 30 94 88 0
|
|
52
|
+
25 91 19 0 +.02 0 .01 0 0 -1 16 25 72 96 ?49 9 93 94 0 0 1 30 19 89 0 9 94 6 0
|
|
53
|
+
+0 0 .01 0 0 -1 81 1 96 122 82 25 0 0 66 97 98 17 49 0 52 50 32 44 47 25 0 53 +
|
|
54
|
+
15 52 77 0 50 99 0 17 32 0 52 49 34 27 26 33 0 0 -17 53 0 78 43 79 44 50 54 0 0
|
|
55
|
+
-15 78 45 0 76 100 0 17 43 0 78 76 53 42 45 48 0 24 -17 79 0 78 53 76 20 41 74
|
|
56
|
+
0 0 -17 41 0 101 60 55 39 79 74 0 72 +15 101 75 0 41 102 0 17 60 0 101 58 41 51
|
|
57
|
+
72 18 0 69 -17 55 0 101 41 58 20 34 93 0 79 +17 58 0 101 55 60 10 30 59 0 0 -17
|
|
58
|
+
34 0 52 32 50 10 55 93 0 58 -16 59 20 103 ?30 18 33 86 0 0 1 81 1 103 119 82 59
|
|
59
|
+
0 0 92 84 104 16 18 74 105 ?72 93 59 6 0 0 1 16 33 16 106 ?26 59 62 87 0 0 1 81
|
|
60
|
+
1 106 113 82 33 0 0 90 23 107 30 87 19 0 33 68 86 0 +.02 0 .01 0 1 0 30 68 14 0
|
|
61
|
+
62 75 87 0 +0 0 .01 1 0 0 30 75 9 0 67 0 68 0 +0 .01 .01 0 -1 0 80 7 CCCCCDI12
|
|
62
|
+
legal_owners0 16 1 lCZ1 82 108 109 9000 1 1 1 1 1 1 1 1 0 FFFFTFTFFFFFFFFF3 81
|
|
63
|
+
1 90 112 82 54 0 0 105 106 110 81 1 23 114 82 9 0 0 106 80 111 84 255 32 107 0b
|
|
64
|
+
2a3274407aed4e172082dbf4432cda84 32 111 bb9c9bfa79c698c71f1933cfffb2975681 1 105
|
|
65
|
+
111 82 18 0 0 0 90 112 84 32 110 e1f495862a1ace6219e45468398581fa84 32 112 38d7
|
|
66
|
+
809b25b021119f9f4a33ab18882b79 255 15 109 UGS/ObjectState81 1 92 118 82 74 0 0 9
|
|
67
|
+
5 103 113 81 1 84 120 82 48 0 0 103 66 114 84 32 104 f95142069bb8de1ac00acb1b8aa
|
|
68
|
+
5c54c81 1 66 121 82 62 0 0 84 96 115 84 32 114 5e2dab98d962b12fead58249e5b462798
|
|
69
|
+
4 32 115 1c7f8240ec619b6d08835e1719573f2e81 1 95 117 82 93 0 0 73 92 116 84 32 1
|
|
70
|
+
13 5efc6f384842474bc93f0e6f13ac888481 1 73 116 82 67 0 0 80 95 117 84 32 116 0c9
|
|
71
|
+
4ab6c4d768a54b7af63dfc2ef049d84 32 117 6964a920e800722074aaaee9d33d113c14 255 10
|
|
72
|
+
2 76 118 ?70 99 101 4 119 -0 0 70 99 22 81 1 118 133 120 102 121 0 122 123 124 1
|
|
73
|
+
4 70 24 123 ?100 102 29 4 125 +0 0 100 102 22 14 99 78 122 ?102 63 52 4 126 -0 0
|
|
74
|
+
102 63 22 50 119 83 0 102 127 126 0 +.02 .01 .01 0 -1 0 0 0 -1 13 22 3 0 0 0 0
|
|
75
|
+
0 0 8 15 14 15 82 128 ?63 0 71 4 5 -0 0 63 0 22 81 1 128 130 120 15 129 0 0 130
|
|
76
|
+
131 14 63 80 130 ?99 15 46 4 17 -0 0 99 15 22 81 1 130 131 120 63 132 0 128 122
|
|
77
|
+
133 50 17 85 0 63 126 5 0 +0 0 .01 0 1 0 0 0 1 50 126 84 0 99 119 17 0 +.02 0 .
|
|
78
|
+
01 -1 0 0 0 0 1 80 1 120 0 134 8001 0 0 0 0 3 5 0 0 0 FFFFTFTFFFFFFFFF2 81 1 132
|
|
79
|
+
128 82 63 0 130 135 0 136 81 1 122 132 120 99 135 0 130 118 137 83 255 3 133 .6
|
|
80
|
+
11764705882353 .658823529411765 .670588235294118 81 1 135 127 82 99 0 122 138 13
|
|
81
|
+
2 139 83 3 137 .611764705882353 .658823529411765 .670588235294118 81 1 138 126 8
|
|
82
|
+
2 100 0 140 121 135 141 84 32 139 9d3883b13d595af472867345059f6d6a14 100 42 140
|
|
83
|
+
?0 70 78 4 127 -0 0 0 70 22 81 1 140 135 120 100 138 0 123 0 142 81 1 121 125 8
|
|
84
|
+
2 102 0 118 129 138 143 84 32 141 3c96f800ce76c571d364c2ff0967d74381 1 129 124 8
|
|
85
|
+
2 15 0 128 97 121 144 84 32 143 7e10e0a70ecdf7eb6817b0b93d7941e381 1 97 123 82 7
|
|
86
|
+
0 0 123 96 129 145 84 32 144 c516f1e80e2dfb2178e15a3f4ee6844181 1 123 134 120 70
|
|
87
|
+
97 0 118 140 146 84 32 145 29bb849388a51915e549376b2505e48783 3 146 .6117647058
|
|
88
|
+
82353 .658823529411765 .670588235294118 83 3 142 .611764705882353 .6588235294117
|
|
89
|
+
65 .670588235294118 50 127 62 0 100 125 119 0 +0 0 0 0 0 1 1 0 0 50 125 25 0 70
|
|
90
|
+
0 127 0 +0 0 .01 0 0 1 1 0 0 84 32 136 3f2f10dd2c92eae466f0cd6f5f3b50a779 15 13
|
|
91
|
+
4 SDL/TYSA_COLOUR83 3 131 .611764705882353 .658823529411765 .670588235294118 83
|
|
92
|
+
3 124 .611764705882353 .658823529411765 .670588235294118 84 32 98 3c77151397400
|
|
93
|
+
cdfafac58bf2849e38384 32 83 8e48dfe233682fdd966554c80bf419b919 16 92 0 1 0 8 4 0
|
|
94
|
+
S0 74 4 CI16 index_map_offset0 0 1 dCCZ20 14 4 0 0 12 132 140 2 0 0 0 0 0 0 0 0
|
|
95
|
+
0 0 0 0 0 0 0 0 81 2 12 109 147 1 0 2 0 0 148 149 80 2 147 150 151 8004 0 0 0 0
|
|
96
|
+
3 5 0 0 0 FFTFFFFFFFFFFFFF2 3 83 1 148 7830.64 84 8 149 Kg/Cu M 79 16 151 SDL/T
|
|
97
|
+
YSA_DENSITY80 1 11 152 153 9000 0 0 0 0 3 5 0 0 0 FFTFFFFFFFFFFFFF1 82 255 1 13
|
|
98
|
+
129 79 24 153 UG2/BODY_COLOR_ATTRIBUTE1 0
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import sys
|
|
3
3
|
import json
|
|
4
|
-
from xml.etree.ElementInclude import include
|
|
5
4
|
|
|
5
|
+
# noinspection PyUnresolvedReferences
|
|
6
6
|
import NXOpen
|
|
7
7
|
|
|
8
8
|
|
|
@@ -91,10 +91,8 @@ def main(
|
|
|
91
91
|
return None
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
|
|
95
94
|
if __name__ == "__main__":
|
|
96
95
|
print('---NX started---')
|
|
97
|
-
# print('current directory: ', os.getcwd())
|
|
98
96
|
print('arguments: ')
|
|
99
97
|
for arg in sys.argv[1:]:
|
|
100
98
|
print('│ ', arg)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
from time import sleep, time
|
|
6
|
+
|
|
7
|
+
# noinspection PyUnresolvedReferences
|
|
8
|
+
from pywintypes import com_error
|
|
9
|
+
|
|
10
|
+
from pyfemtet._i18n import _
|
|
11
|
+
|
|
12
|
+
from pyfemtet.opt.problem.variable_manager import SupportedVariableTypes
|
|
13
|
+
from pyfemtet.opt.interface._base_interface import AbstractFEMInterface
|
|
14
|
+
from pyfemtet.opt.interface._femtet_interface import FemtetInterface
|
|
15
|
+
from pyfemtet.opt.interface._solidworks_interface import SolidworksInterface
|
|
16
|
+
from pyfemtet.opt.exceptions import *
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FemtetWithSolidworksInterface(FemtetInterface, SolidworksInterface, AbstractFEMInterface):
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
sldprt_path: str,
|
|
27
|
+
femprj_path: str = None,
|
|
28
|
+
model_name: str = None,
|
|
29
|
+
connect_method: str = "auto",
|
|
30
|
+
save_pdt: str = "all",
|
|
31
|
+
strictly_pid_specify: bool = True,
|
|
32
|
+
allow_without_project: bool = False,
|
|
33
|
+
open_result_with_gui: bool = True,
|
|
34
|
+
parametric_output_indexes_use_as_objective: dict[int, str | float] = None,
|
|
35
|
+
always_open_copy=False,
|
|
36
|
+
close_solidworks_on_terminate=False,
|
|
37
|
+
solidworks_visible=True,
|
|
38
|
+
):
|
|
39
|
+
SolidworksInterface.__init__(
|
|
40
|
+
self,
|
|
41
|
+
sldprt_path=sldprt_path,
|
|
42
|
+
close_solidworks_on_terminate=close_solidworks_on_terminate,
|
|
43
|
+
visible=solidworks_visible,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
FemtetInterface.__init__(
|
|
47
|
+
self,
|
|
48
|
+
femprj_path=femprj_path,
|
|
49
|
+
model_name=model_name,
|
|
50
|
+
connect_method=connect_method,
|
|
51
|
+
save_pdt=save_pdt,
|
|
52
|
+
strictly_pid_specify=strictly_pid_specify,
|
|
53
|
+
allow_without_project=allow_without_project,
|
|
54
|
+
open_result_with_gui=open_result_with_gui,
|
|
55
|
+
parametric_output_indexes_use_as_objective=parametric_output_indexes_use_as_objective,
|
|
56
|
+
always_open_copy=always_open_copy,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
self._warn_if_undefined_variable = False
|
|
60
|
+
|
|
61
|
+
def _check_param_and_raise(self, param_name) -> None:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
def _setup_before_parallel(self):
|
|
65
|
+
SolidworksInterface._setup_before_parallel(self)
|
|
66
|
+
FemtetInterface._setup_before_parallel(self)
|
|
67
|
+
|
|
68
|
+
def _setup_after_parallel(self, opt: AbstractOptimizer = None):
|
|
69
|
+
SolidworksInterface._setup_after_parallel(self, opt)
|
|
70
|
+
FemtetInterface._setup_after_parallel(self, opt)
|
|
71
|
+
|
|
72
|
+
def update_parameter(self, x: dict[str, SupportedVariableTypes], with_warning=False) -> None:
|
|
73
|
+
SolidworksInterface.update_parameter(self, x)
|
|
74
|
+
FemtetInterface.update_parameter(self, x, with_warning)
|
|
75
|
+
|
|
76
|
+
def _export_xt(self, xt_path):
|
|
77
|
+
|
|
78
|
+
# 前のが存在するならば消しておく
|
|
79
|
+
if os.path.isfile(xt_path):
|
|
80
|
+
os.remove(xt_path)
|
|
81
|
+
|
|
82
|
+
# export as x_t
|
|
83
|
+
self.swModel.SaveAs(xt_path)
|
|
84
|
+
|
|
85
|
+
# 30 秒待っても x_t ができてなければエラー(COM なのでありうる)
|
|
86
|
+
timeout = 30
|
|
87
|
+
start = time()
|
|
88
|
+
while True:
|
|
89
|
+
if os.path.isfile(xt_path):
|
|
90
|
+
break
|
|
91
|
+
if time() - start > timeout:
|
|
92
|
+
raise ModelError(_(
|
|
93
|
+
en_message='Failed to update Solidworks model.',
|
|
94
|
+
jp_message='Solidworks モデルの更新に失敗しました。',
|
|
95
|
+
))
|
|
96
|
+
sleep(1)
|
|
97
|
+
|
|
98
|
+
def update_model(self):
|
|
99
|
+
|
|
100
|
+
# solidworks のモデルの更新
|
|
101
|
+
SolidworksInterface.update_model(self)
|
|
102
|
+
|
|
103
|
+
# 競合しないよう保存先を temp にしておく
|
|
104
|
+
worker_space = self._get_worker_space()
|
|
105
|
+
xt_path = os.path.join(worker_space, 'temp.x_t')
|
|
106
|
+
|
|
107
|
+
# export parasolid
|
|
108
|
+
self._export_xt(xt_path)
|
|
109
|
+
|
|
110
|
+
# LastXTPath を更新する
|
|
111
|
+
try:
|
|
112
|
+
self.Femtet.Gaudi.LastXTPath = xt_path
|
|
113
|
+
except (KeyError, AttributeError, com_error):
|
|
114
|
+
raise RuntimeError('This feature is available from Femtet version 2023.2. Please update Femtet.')
|
|
115
|
+
|
|
116
|
+
# update_parameter で変数は更新されているので
|
|
117
|
+
# ここでモデルを完全に再構築できる
|
|
118
|
+
FemtetInterface.update_model(self)
|
|
119
|
+
|
|
120
|
+
def close(self, timeout=15, force=True):
|
|
121
|
+
SolidworksInterface.close(self)
|
|
122
|
+
FemtetInterface.close(self, timeout, force)
|