Importing python modules to MagicDraw

General discussions about MagicDraw

Moderator: Moderators

Importing python modules to MagicDraw

Postby mhbl3@gatech.edu » Wed Oct 17, 2018 12:28 am

Hello,

Is there a way to import a python module (like numpy for example) to MagicDraw and use it with the scripting engine?
There was one post talking about it but it did not really help me.

Thanks!
mhbl3@gatech.edu
Forum Newbie
Forum Newbie
 
Posts: 18
Posts Rating:0
Joined: Fri May 18, 2018 11:35 am

Re: Importing python modules to MagicDraw

Postby tomas.lukosius@nomagic.com » Fri Oct 19, 2018 7:58 am

Hello,

It is possible to import 3rd party modules.
You can put a .py file in in this path(/MagicDraw/<version>/plugins/com.nomagic.magicdraw.automaton/engines/jython/Lib) and then reference it.
Also it is possible to add additional modules path to Jython. Information how jython searches for modules and how to customize the path can be found here http://www.jython.org/jythonbook/en/1.0 ... kages.html

I hope this helps.
tomas.lukosius@nomagic.com
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:4
Joined: Tue Aug 30, 2016 12:22 am

Re: Importing python modules to MagicDraw

Postby kfisher@strattechnologies.com » Fri Aug 05, 2022 1:43 pm

Still struggling to import/use numpy in 2021x via opaque actions.
Numpy init.py will throw errors when I attempt to import numpy directly by adding the numpy package to the site-packages folder or by using python/sys to add the path to the native install of numpy.
Is it possible to import numpy into jython/python? Some light research shows that numpy requires C that jython doesnt seem to support.
Does 2021x truly have a python engine? There is not a python engine in the automaton file.
kfisher@strattechnologies.com
Forum Newbie
Forum Newbie
 
Posts: 17
Posts Rating:0
Joined: Wed Mar 03, 2021 9:43 am


Return to MagicDraw

Who is online

Users browsing this forum: No registered users and 1 guest

cron