How to Import clr and AddReference using pymechanical embedded #1035
-
In ansys mechanical Import clr and AddReference are working in scripting, but using pymechnical facing some issues. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
@RobPasMue any suggestion here.? |
Beta Was this translation helpful? Give feedback.
-
@B-Naveen-Kumar
This is because the code that initializes the app will make changes to the CLR environment |
Beta Was this translation helpful? Give feedback.
-
@koubaa , I tried it at my end. Its not working |
Beta Was this translation helpful? Give feedback.
-
Which reference are you trying to add? |
Beta Was this translation helpful? Give feedback.
-
Microsoft |
Beta Was this translation helpful? Give feedback.
-
@B-Naveen-Kumar That doesn't work inside of mechanical scripting: |
Beta Was this translation helpful? Give feedback.
-
Hi @koubaa . Initaily we need to import Microsoft also. Here is for your reference. But in PyMechanical how to do this.? |
Beta Was this translation helpful? Give feedback.
-
Hello, With CPython, you need to add the reference before importing the namespace. So it would look more like:
I tried it, and python doesn't know where to find that reference. I found it in my system in the GAC at this location: C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.PowerPoint\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.PowerPoint.dll I was able to get this to work:
You should consider bundling the office interop with your deployment. |
Beta Was this translation helpful? Give feedback.
-
Thanks @koubaa, vll work around |
Beta Was this translation helpful? Give feedback.
Hello,
With CPython, you need to add the reference before importing the namespace.
So it would look more like:
I tried it, and python doesn't know where to find that reference. I found it in my system in the GAC at this location: C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.PowerPoint\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.PowerPoint.dll
I was able to get this to work: