简体   繁体   English

MagicDraw 是否有 Python 接口或 API 包装器?

[英]Does MagicDraw have a Python interface or API wrapper?

I use MagicDraw for Model Based System Engineering (MBSE) using UML and SysML.我使用 UML 和 SysML 对基于 Model 的系统工程 (MBSE) 使用 MagicDraw。 I know there is an API based in Java, which the tool is primarily written in, but I'd like to interface to my models using Python.我知道有一个基于 Java 的 API,该工具主要是用它编写的,但我想使用 Python 与我的模型交互。

Is there an API wrapper or other method of accessing MagicDraw using Python?是否有 API 包装器或其他使用 Python 访问 MagicDraw 的方法?

The MagicDraw Developers Guide (currently for v19.0-SP2) has information on their OpenAPI, which supports Jython , which is a Java implementation of Python. MagicDraw 开发人员指南(当前适用于 v19.0-SP2)包含有关其 OpenAPI 的信息,该 API 支持Jython ,这是 Python 的 Java 实现。

The OpenAPI implementation allows writing scripts for MagicDraw that can be called from any MagicDraw Query (for example, expressions in table scopes, table custom column definitions, and queries in Legend Adornments). OpenAPI 实现允许编写可从任何 MagicDraw 查询调用的 MagicDraw 脚本(例如,表范围内的表达式、表自定义列定义和 Legend Adornments 中的查询)。

There is information on Jython scripting here in the OpenAPI documentation . OpenAPI 文档中有关于 Jython 脚本的信息。

Notes on Jython:关于 Jython 的注意事项:

The core Python development is CPython, which is primarily in C and compiles to given targets like C. Python 开发的核心是 CPython,主要在 C 中并编译到给定的目标,如 C。 The Jython port is compatible with Java and targets the Java JVM rather than compiling for a particular platform. Jython 端口与 Java 兼容,并针对 Java JVM 而不是针对特定平台进行编译。

This allows running a Jython interpreter for Python as a class object directly in Java, and writing Jython scripts that run on the JVM directly. This allows running a Jython interpreter for Python as a class object directly in Java, and writing Jython scripts that run on the JVM directly.

Jython currently only supports Python 2.7. Jython 目前仅支持 Python 2.7。 There has been development of Jython for Python 3.5 under development in the past, though it is "resting" at the moment, as stated in this SO answer过去已经为 Python 3.5 开发了 Jython,尽管它目前处于“休息”状态,如this SO answer中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM