python development in Mecway ironpython install

Hello, I have a few questions about how to access the python interpreter that comes with Mecway. I have never used ironpython before.

I'd like to be able to install packages using pip, create virtual environments, and that sort of thing. I believe all of this should be possible, since there is an ensurepip package inside of the Mecway13\IronPython.2.7.9\Lib folder.

It appears that unlike cpython, in ironpython there is no python.exe. Instead, I only see a DLL file in the ironpython\lib folder. However, reading online it appears that ironpython does use a ipy.exe (rather than python.exe for cpython). But I cannot find any ipy.exe file on my machine anywhere.

It is probably obvious that I have never done any .NET development before and have no idea how to access the equivalent of the python executable that comes with Mecway. How can I do this?

Comments

  • I can't offer much help with that except to say that it runs IronPython from a dll like you found so Mecway.exe is the python interpreter executable. You can probably find ipy.exe somewhere else and it might work with Mecway but it won't be able to access the same API since the main objects are created on the fly by Mecway before running each script.
  • Hi,

    I installed IronPython and it pulls the resources that I needed in Mecway in order for the modules to work.

    If you want a bit more complex python example, I have created a script in python to calculate average bending moments / length (either u or v direction) from surfaces ( mainly using 'quad8' in Mecway ) and get the number of reinforcement bars on a certain length - see attached file.

    I wrote an explanation in front of every command so you can understand what is doing. If you have .NET or Visual Basic experience, the logic should be quite clear.

    In order to work, please change the extension from '.txt' to '.py'.

    Hope it helps.
  • Thanks all. Unfortunately it appears, then, there is no way for me to do what it is I wish to do. Ah well.
  • edited October 2020
    Victor is there any way you can modify the python 2 install in a future version of Mecway so it creates a ipy.exe file inside the Mecway program folder, in addition to the DLL file? So that the Mecway python environment can be run from the command line rather than just from .py scripts when inside of Mecway? This would be most helpful.
  • If I understand you correctly, then no because it depends on the Mecway application running to access its internal state.

    Perhaps that would be possible by having a wrapper Python (even Python 3) library that starts an instance of the Mecway application then interfaces with it. But that's a whole different architecture which I don't intend to develop.
  • I understand you will not be able to access the running application. However, it would allow you to pip install 3rd party packages and make them available for import to the environment when the Mecway script is run.

    Third party packages could be "installed" by copying the files to site packages folder, but pip is so much easier to use.
  • I don't understand how that would work, but if it's simply a matter of having ipy.exe installed with Mecway, that should be no problem. Is that all it needs?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!