From 6804fea7df2a153a8d811f08e2e15aa3dc4a5997 Mon Sep 17 00:00:00 2001 From: Bence Balogh Date: Mon, 21 Feb 2022 09:17:13 +0100 Subject: [PATCH] changes due to the new comtypes release --- README.md | 2 +- examples/NavierPlate.ipynb | 42 +++++++++++++++--------------- examples/ss_beam_M.ipynb | 52 ++++++++++++++++++++++++-------------- examples/ss_beam_P.ipynb | 2 +- src/axisvm/com/axdomain.py | 10 +++++--- tips_and_tricks.md | 10 +------- 6 files changed, 63 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 3c910eb..7055bc5 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ areas = axmodel.Surfaces[:].Area Click [***here***](https://github.com/AxisVM/pyaxisvm/blob/6abfebdfd26a76721836e1b490465d1f5a474a83/tips_and_tricks.md) to get a full overview about the pythonic usage of the library. -## **License and Acknowledgments** +## **License and Acknowledgements** **PyAxisVM** is licensed under the MIT license. diff --git a/examples/NavierPlate.ipynb b/examples/NavierPlate.ipynb index 5c189f3..87c9c73 100644 --- a/examples/NavierPlate.ipynb +++ b/examples/NavierPlate.ipynb @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -73,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -104,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -135,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -156,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -197,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -207,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -235,7 +235,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -244,7 +244,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -303,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -312,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ @@ -341,7 +341,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -365,7 +365,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -419,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -458,7 +458,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -467,7 +467,7 @@ "1" ] }, - "execution_count": 16, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -494,7 +494,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -503,7 +503,7 @@ "1" ] }, - "execution_count": 17, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -561,11 +561,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ - "del axvm" + "axvm.Quit()" ] } ], diff --git a/examples/ss_beam_M.ipynb b/examples/ss_beam_M.ipynb index 86f63ac..c88dd2e 100644 --- a/examples/ss_beam_M.ipynb +++ b/examples/ss_beam_M.ipynb @@ -37,9 +37,23 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Exception ignored in: \n", + "Traceback (most recent call last):\n", + " File \"f:\\GitHub\\pyaxisvm\\.venv\\lib\\site-packages\\axisvm\\com\\axapp.py\", line 53, in __del__\n", + " self.Quit()\n", + " File \"f:\\GitHub\\pyaxisvm\\.venv\\lib\\site-packages\\axisvm\\com\\axapp.py\", line 48, in Quit\n", + " self._wrapped.UnLoadCOMClients()\n", + "_ctypes.COMError: (-2147023174, 'The RPC server is unavailable.', (None, None, None, 0, None))\n" + ] + } + ], "source": [ "from axisvm.com.client import start_AxisVM\n", "axvm = start_AxisVM(visible=True, daemon=True)\n" @@ -54,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -77,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -102,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -129,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -160,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -190,7 +204,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -211,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -255,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -298,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -356,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -391,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -400,7 +414,7 @@ "1" ] }, - "execution_count": 12, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -427,7 +441,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -436,7 +450,7 @@ "1" ] }, - "execution_count": 13, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -495,7 +509,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -526,7 +540,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -581,7 +595,7 @@ "metadata": {}, "outputs": [], "source": [ - "del axvm" + "axvm.Quit()" ] } ], diff --git a/examples/ss_beam_P.ipynb b/examples/ss_beam_P.ipynb index a5af9a4..405aa69 100644 --- a/examples/ss_beam_P.ipynb +++ b/examples/ss_beam_P.ipynb @@ -481,7 +481,7 @@ "metadata": {}, "outputs": [], "source": [ - "del axvm" + "axvm.Quit()" ] } ], diff --git a/src/axisvm/com/axdomain.py b/src/axisvm/com/axdomain.py index 44f9dbf..cc4963a 100644 --- a/src/axisvm/com/axdomain.py +++ b/src/axisvm/com/axdomain.py @@ -30,6 +30,7 @@ def ABDS(self, *args, compose=True, **kwargs): else: return A, B, D, S + def GenerateMesh(self, *args, **kwargs): """ Generates a mesh for the domain. If successful, returns the @@ -48,10 +49,11 @@ def GenerateMesh(self, *args, **kwargs): UPDATE : The pull request and the included bugfix is accepted and will be included in comtypes v1.10.11. (2022.01.28) """ - try: - return self._wrapped.GenerateMesh(*args, **kwargs) - except IndexError: - pass + return self._wrapped.GenerateMesh(*args, **kwargs) + #try: + # return self._wrapped.GenerateMesh(*args, **kwargs) + #except IndexError: + # pass class AxDomains(AxWrapper): diff --git a/tips_and_tricks.md b/tips_and_tricks.md index cfd4d48..9ebc068 100644 --- a/tips_and_tricks.md +++ b/tips_and_tricks.md @@ -105,16 +105,8 @@ axapp.AskSaveOnLastReleased = False axapp.ApplicationClose = axtlb.acEnableNoWarning ``` -As a result of these settings, if the COM server is shut down, AxisVM shuts down either, hence the term `daemon`. Shutting down the COM server can be done as: +As a result of these settings, if the COM server is shut down, AxisVM shuts down either, hence the term `daemon`. Shutting down the COM server can be done with typing ```python axapp.Quit() ``` - -or - -```python -del axapp -``` - -The difference here is that in the second case `axapp` gets garbage collected (killing the connection before), whereas in the first case it only kills the connection. \ No newline at end of file