pyfemtet 0.6.5__py3-none-any.whl → 0.6.6__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.6.5"
1
+ __version__ = "0.6.6"
@@ -0,0 +1,3 @@
1
+ from pyfemtet.brep._impl import ModelUpdater
2
+
3
+ __all__ = ['ModelUpdater']
pyfemtet/brep/_impl.py ADDED
@@ -0,0 +1,14 @@
1
+ try:
2
+ import brepmatching
3
+ except ModuleNotFoundError as e:
4
+ import warnings
5
+ warnings.warn(
6
+ 'There is no installation of `brepmatching`. '
7
+ 'Please confirm installation via '
8
+ '`pip install pyfemtet[brep]` or '
9
+ '`pip install brepmatching` command.'
10
+ )
11
+ raise e
12
+
13
+ from brepmatching.pyfemtet_scripts.replace_model_considering_their_matching import ModelUpdater
14
+
@@ -263,15 +263,15 @@ class ExcelInterface(FEMInterface):
263
263
  try:
264
264
  with watch_excel_macro_error(self.excel, timeout=self.procedure_timeout):
265
265
  self.excel.Run(
266
- f'{self.wb_input.Name}!{self.procedure_name}',
266
+ f'{self.procedure_name}',
267
267
  *self.procedure_args
268
268
  )
269
269
 
270
270
  # 再計算
271
271
  self.excel.CalculateFull()
272
272
 
273
- except com_error:
274
- raise SolveError(f'Failed to run macro {self.wb_input.Name}!{self.procedure_name}')
273
+ except com_error as e:
274
+ raise SolveError(f'Failed to run macro {self.procedure_name}. The original message is: {e}')
275
275
 
276
276
 
277
277
  def quit(self):
@@ -293,7 +293,7 @@ class ExcelInterface(FEMInterface):
293
293
  gc.collect()
294
294
 
295
295
  # quit した後ならば femtet を終了できる
296
- # excel の process の完全消滅を待つ
296
+ # excel の process の消滅を待つ
297
297
  logger.info('Excel の終了を待っています。')
298
298
  while self._excel_pid == _get_pid(self._excel_hwnd):
299
299
  sleep(1)
@@ -301,12 +301,14 @@ class ExcelInterface(FEMInterface):
301
301
  # 正確だが時間がかかるかも
302
302
  logger.info('終了する Femtet を特定しています。')
303
303
  femtet_pid = util.get_last_executed_femtet_process_id()
304
- Femtet, caught_pid = dispatch_specific_femtet(femtet_pid)
305
- _exit_or_force_terminate(timeout=3, Femtet=Femtet, force=True)
304
+ from multiprocessing import Process
305
+ p = Process(target=_terminate_femtet, args=(femtet_pid,))
306
+ p.start()
306
307
 
307
308
  logger.info('自動保存機能の設定を元に戻しています。')
308
309
  _set_autosave_enabled(self._femtet_autosave_buffer)
309
310
 
311
+ p.join()
310
312
  logger.info('Excel-Femtet を終了しました。')
311
313
 
312
314
  # 直接アクセスしてもよいが、ユーザーに易しい名前にするためだけのプロパティ
@@ -425,6 +427,11 @@ def wait_femtet():
425
427
  Femtet = Dispatch('FemtetMacro.Femtet')
426
428
 
427
429
 
430
+ def _terminate_femtet(femtet_pid_):
431
+ CoInitialize()
432
+ Femtet, caught_pid = dispatch_specific_femtet(femtet_pid_)
433
+ _exit_or_force_terminate(timeout=3, Femtet=Femtet, force=True)
434
+
428
435
  # main thread で作成した excel への参照を含む関数を
429
436
  # 直接 thread や process に渡すと機能しない
430
437
  class ScapeGoatObjective:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyfemtet
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  Home-page: https://github.com/pyfemtet/pyfemtet
6
6
  License: BSD-3-Clause
@@ -12,8 +12,10 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Provides-Extra: brep
15
16
  Requires-Dist: babel (>=2.15.0,<3.0.0)
16
17
  Requires-Dist: botorch (==0.9.5)
18
+ Requires-Dist: brepmatching (>=0.1.6,<0.2.0) ; extra == "brep"
17
19
  Requires-Dist: colorlog (>=6.8.0,<7.0.0)
18
20
  Requires-Dist: dash (>=2.17.0,<3.0.0)
19
21
  Requires-Dist: dash-bootstrap-components (>=1.5.0,<2.0.0)
@@ -1,4 +1,4 @@
1
- pyfemtet/__init__.py,sha256=_f8whmZJ36ZCTk0Zldzy3KONxDBm0bxyKt7pCSHC3cE,21
1
+ pyfemtet/__init__.py,sha256=GTf8rijLTDSqTWQgxKQN312t-j2E-t3ioZB4U22DXxc,21
2
2
  pyfemtet/_femtet_config_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pyfemtet/_femtet_config_util/autosave.py,sha256=dNirA9XGuFehas8_Jkj2BW9GOzMbPyhnt1WHcH_ObSU,2070
4
4
  pyfemtet/_femtet_config_util/exit.py,sha256=sx8Wcepgi-lL5qJpJl6WvlzbeVheU9_Dtf1f38mmoTo,1822
@@ -12,6 +12,8 @@ pyfemtet/_message/messages.py,sha256=F8ENLZKoHq5irn-Ag7rqA3aSDsTmRWDyNHvOLY76ROI
12
12
  pyfemtet/_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  pyfemtet/_util/excel_macro_util.py,sha256=Euxz3QmvTnnQCkWnbnPhvX7xXxppRONX69VlFxNCojA,7540
14
14
  pyfemtet/_warning.py,sha256=TSOj8mOhuyfOUJB24LsW6GNhTA3IzIEevJw_hLKTrq8,2205
15
+ pyfemtet/brep/__init__.py,sha256=V1IQ2s-8eWjXOVlTp2jMav9u-NBiSkmyAX1vmtHDEso,73
16
+ pyfemtet/brep/_impl.py,sha256=Amf_wsUxUosQB3XXhErJ5RGKXBxRnaaPpavb_0Xx6Ek,404
15
17
  pyfemtet/core.py,sha256=3lqfBGJ5IuKz2Nqj5pRo7YQqKwx_0ZDL72u95Ur_1p0,1386
16
18
  pyfemtet/dispatch_extensions/__init__.py,sha256=MI9b6oIS2IXnTNHy8jvZ4QURdTHQd9PN-gifYxqVvk4,272
17
19
  pyfemtet/dispatch_extensions/_impl.py,sha256=HU7rKRAzEe5yYukWrKtdi1aIbUas_kLyaa_KZZGCELE,16244
@@ -26,7 +28,7 @@ pyfemtet/opt/_test_utils/hyper_sphere.py,sha256=nQhw8EIY0DwvcTqrbKhkxiITLZifr4-n
26
28
  pyfemtet/opt/_test_utils/record_history.py,sha256=JCNJLZMCNTpJ6VT7iwEt2DIbwmsuQmgC0ClQSfcatj4,3915
27
29
  pyfemtet/opt/interface/__init__.py,sha256=5hel-mP6tuxzIEJFMZJZWUEWEbFSsskzCWlQ3HORTYI,466
28
30
  pyfemtet/opt/interface/_base.py,sha256=aPJ55dTp4-Q4KMkUZVRlquuBBWWOIOdC6yQsYZR4Jy0,2626
29
- pyfemtet/opt/interface/_excel_interface.py,sha256=7wJ8SOJaCyl6rVnmjLjw67Yv95bO1gwFBThc-cDLRYE,16649
31
+ pyfemtet/opt/interface/_excel_interface.py,sha256=kUNTtv98Zfot1ZJk281fhg6-EGQp8Jf_T8MeuO9LS08,16830
30
32
  pyfemtet/opt/interface/_femtet.py,sha256=dmKyRG8sWuX2JHjcXpvJ2q632oZh4I94iVo4u7Z7w_M,34742
31
33
  pyfemtet/opt/interface/_femtet_parametric.py,sha256=KDG8SB43AgwuhpCStjvx10G0RzyHhga6k4dfvp0gvYU,2175
32
34
  pyfemtet/opt/interface/_femtet_with_nx/__init__.py,sha256=-6W2g2FDEcKzGHmI5KAKQe-4U5jDpMj0CXuma-GZca0,83
@@ -118,8 +120,8 @@ pyfemtet/opt/visualization/result_viewer/.gitignore,sha256=ryvb4aqbbsHireHWlPQfx
118
120
  pyfemtet/opt/visualization/result_viewer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
121
  pyfemtet/opt/visualization/result_viewer/application.py,sha256=WcHBx_J5eNLKSaprpk9BGifwhO04oN8FiNGYTWorrXA,1691
120
122
  pyfemtet/opt/visualization/result_viewer/pages.py,sha256=laEAKHAtdshCAHxgXo-zMNg3RP6lCxfszO3XwLnF1dU,32156
121
- pyfemtet-0.6.5.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
122
- pyfemtet-0.6.5.dist-info/METADATA,sha256=04L0xEjP4MQaiIYEV0YZ6rXzf2P1ruOZzyW4hvhsXts,3287
123
- pyfemtet-0.6.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
124
- pyfemtet-0.6.5.dist-info/entry_points.txt,sha256=ZfYqRaoiPtuWqFi2_msccyrVF0LurMn-IHlYamAegZo,104
125
- pyfemtet-0.6.5.dist-info/RECORD,,
123
+ pyfemtet-0.6.6.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
124
+ pyfemtet-0.6.6.dist-info/METADATA,sha256=4fvkbBciIFpFpL6UBZ7EQ62imk4AdT9AwbuPGXTbktE,3371
125
+ pyfemtet-0.6.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
126
+ pyfemtet-0.6.6.dist-info/entry_points.txt,sha256=ZfYqRaoiPtuWqFi2_msccyrVF0LurMn-IHlYamAegZo,104
127
+ pyfemtet-0.6.6.dist-info/RECORD,,