Select Jython, BeanShell, Groovy, JRuby, or JavaScript. Click the box next to the Default Macro Language box to see a list of supported programmingįigure 3 - Selecting Macro Language 4. Select the Macros node (Figure 2).įigure 2 - The Environment Options Dialog 3. The Environmentįigure 1 - Environment Options Dialog Menu 2. Click Options > Environment on the MagicDraw main menu (Figure 1). Working with Macro Engine 2.1 Selecting a Default Macro Language Use the Environment Options dialog to select a default macro language. If you are using MagicDraw 18.1 or greater with Java 8 and created a macro with the new language syntax in Nashorn, and then downgraded your Java to Java 7, this will cause an execution problem for your macro.Ģ.
You can find MagicDraw Open API in MagicDraw OpenAPI UserGuide.pdf in the manual directory and sample macros in /samples/product features/macros. With Macro Engine, you can control everything that is allowed in Open API, for example, transforming and manipulating models. Introduction Macro Engine (previously called Script Engine) in MagicDraw allows you to create your own macro (script) by using BeanShell, Groovy, JRuby, JavaScript (Nashorn and Rhino), or Jython.
Appendix 35 3.1 Using Code Completion to Develop BeanShell Scripts 35 3.2 Using NetBeans IDE to Develop Groovy Scripts 36 3.3 Using Eclipse to Develop Groovy Scripts 37 3.4 Installing Gems for JRuby 38 3.5 Adding a Scripting Language to MagicDraw 39 3.5.1 Script Filename Extension Filter 39 Working with Macro Engine 4 2.1 Selecting a Default Macro Language 4 2.2 Creating a Macro 7 2.3 Adding a Macro and Editing Macro InformationĢ.3.1 Opening Macro Information Dialog 8 2.3.2 Adding a Macro and Its Information 9 2.3.3 Editing Macro Information 14 2.3.4 Macro Information Dialog Mnemonic Keys 15Ģ.4.1 Deleting a Macro 15 2.4.2 Executing a Macro 16 2.4.3 Organizing Macros Dialog Mnemonic Keys 18Ģ.5.1 Assigning a Keyboard Shortcut to a Macro 22 2.5.2 Removing Keyboard Shortcuts from Macro 22Ģ.6 Opaque Objects 23 2.6.1 Getting an Opaque Object 23 2.6.2 Getting Element Property Values 24 2.6.3 Setting Element Property Values 25 2.6.4 Getting the Child of an Element 28 2.6.5 Getting the Owner of an Element 29 2.6.6 Creating a New Element 29 2.6.7 Creating a Relationship Between Elements 29 2.6.8 Removing an Element 30 2.6.9 Adding a Stereotype to an Element 30 2.6.10 Removing a Stereotype from an Element 30 2.6.11 Printing Element Details 31ģ. All information copyright 2009-2015 by No Magic, Inc.ĬONTENTS MACRO ENGINE 1.
and is not to be shared, copied, or reproduced by any means. All material contained herein is considered proprietary information owned by No Magic, Inc.