Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - philchudley

Pages: [1] 2 3 ... 36
1
Hi All

I have solved the problem

The delimiter to be used is <p> (HTML Paragraph)

The string representing the custom field is added to the XML with a formatted attribute with a value of 1

Cheers

Phil

2
Hi All

I am developing a script for a documentation template fragment.

Part of this involves processing a list of GUIDS from a refGUIDList tagged value, getting each GUID is easy, but as part of the XML returned which contains several custom fields, I wish to return a CustomField called, say ELELIST which is a newline delimited string of element names

Does anyone know how to achieve this?

I have tried using \n as the delimiter as well as &#13;&#10; all are simply ignored during documentation generation and all element names appear on a single line of text.

Phil

3
Thanks for all the help guys

I have now got the Add In window working perfectly

Cheers

Phil

4
Hi All

I am attempting to add a custom window to an addin and have used Sparx's rather brief notes

http://sparxsystems.com/enterprise_architect_user_guide/13.5/automation/custom_docked_window.html

However the addiin window is not added:

I am using Visual Studio 2013 and C# .Net 4.5

My Code is as below:

The very simple Test Addin:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestAddIn
{
    public class TestAddIn
    {
        // ----------------------------------------------------------------------
        // Menu Strings
        // ----------------------------------------------------------------------

        private String menuHeader = null;
        private String[] menuOptions = { null };

        private bool safeDeleteIsEnabled;
        private MyCustomControl myCustomControl;       
 
        //-----------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------

        public TestAddIn()
        {
            safeDeleteIsEnabled = true;
            menuHeader = "-&Tester";
            menuOptions = new String[] { "&Checked", "-", "&Unchecked", "-", "&Show Window", "&Hide Window"};

        }

        // Enterprise Architect standard extension methods

        public void EA_Connect(EA.Repository repository)
        {

            myCustomControl = (MyCustomControl)repository.AddWindow
                     ("Test Addin", "TestAddIn.MyCustomControl");
            if (myCustomControl == null)
            {
                MessageBox.Show("Test AaddIn Custom Window not added");
            }
            else
            {
                MessageBox.Show("Test AddIn Custom Window added);
         }
        }

        public void EA_Disconnect()
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }

        public object EA_GetMenuItems(EA.Repository repository,
                                      string menuLocation,
                                      string menuName)
        {

            if (menuName == String.Empty)
            {
                //return top level menu option
                return menuHeader;
            }
            if (menuName == this.menuHeader)
            {
                // return submenu options
                return menuOptions;
            }
            else
            {
                return string.Empty;
            }
        }

        public void EA_GetMenuState(EA.Repository repository,
                                    string menuLocation,
                                    string menuName,
                                    string itemName,
                                    ref bool isEnabled,
                                    ref bool isChecked)
        {
            switch (menuLocation)
            {
                case "MainMenu":
                    switch (itemName)
                    {
                        case "&Checked":
                            isEnabled = true;
                            isChecked = safeDeleteIsEnabled;
                            break;
                        case "&Unchecked":
                            isEnabled = true;
                            isChecked = !safeDeleteIsEnabled;
                            break;
                    }
                    break;
            }
        }

        public void EA_MenuClick(EA.Repository repository,
                                    string menuLocation,
                                    string menuName,
                                    string itemName)
        {
            switch (itemName)
            {
                case "&Checked":
                    safeDeleteIsEnabled = !safeDeleteIsEnabled;
                    break;
                case "&Unchecked":
                    safeDeleteIsEnabled = !safeDeleteIsEnabled;
                    break;
            }
        }
    }

}

The addin window has been added to the solutions as a Visual Studio Custom Control and the Code is:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestAddIn
{
    public partial class MyCustomControl : Control
    {
        public MyCustomControl()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}

Everything builds fine and the addin works fine, but the reference nyCustomControl is always null thus indicating the Custom Window has not not been added.

Using the Extend | Manage | Add-in Windows returns No loaded add-ins are using this window

I must be missing something, but what?

All namespaces and names are correct.s

One curious thing, the article by Sparx on Custom Windows, mentions an ActiveX Custom Control and and OCX file. I do not see any OCX file in my build, so if this is what is missing, how is such an OCX file created, and where should it be located.

Any help or advice will be most appreciated.

Phil

5
Check the ID used when the MDG is generated.

The ID must be the same name as the name used in the MDG packages, for example, if using the Model Wizard to create an MDG project browser structure, you are prompted for a name, let's say you entered MYMDG, this name is then used throughout the package structure for the MDG model.

When generating the MDG ensure that you use MYMDG as the ID, then all should be OK.

Once more thing, the ID cannot be more than 12 characters, so when choosing a name for the MDG bear this in mind.

Hope this helps
Phil

6
Uml Process / Re: How to change default programming language?
« on: October 03, 2017, 07:24:11 pm »
In addition to what Geert has suggested you can make the Code Generation Toolbar visible:

1) From the Start Ribbon select the Preferences drop down and select Customize from the menu
2) Select Toolbars
3) Check Code Generation

Select C# from the drop down in the Code Generation Toolbar

Phil


7
This is what I do

1) Model the callable process on a temporary diagrams, make it a composite element, set the sub-process and callable tagged values.
2) Double-click and model the process.
3) I have a package in my BPMN 2.0 elements library called Callable Processes, I move the callable process from 1) together with its child diagram and elements to this package,
4) Delete the temporary diagram.
5) When I want to use by callable process(es) in other process diagrams, simple re-use from the library package as LINK

Changing the name in the library, will of course change the name wherever the callable process has been used.

Phil

8
Automation Interface, Add-Ins and Tools / Re: Tagged Value Groups
« on: August 02, 2017, 05:49:48 pm »
Thanks I had a feeling that might be the case.

Phil

9
Automation Interface, Add-Ins and Tools / Tagged Value Groups
« on: August 01, 2017, 10:54:29 pm »
Hi All

Does anyone know a method in script (or SQL) to discover what Tagged Value Group a given tagged value is in?

I know that tagged value group membership is defined with a MDG Profile stereotype in the element attribute _tagGroupings, but how to access this information within a script / addin?

Cheers

Phil

10
When you create an MDG you get a toolbox containing elements within your MDG (assuming that you not define your own toolboxes). Either way, open up the toolbox containing your MDG elements (Toolbox | More Tools...)

Right-click on an element within your MDG toolbox
Select Synchronize Stereotype

You should see a dialog display

Click OK

After a while all affected elements will be displayed
Click Cancel

Repeat for all other elements in your MDG

NOTE
This action will update the Tagged Values associated with the stereotype defined within your MDG and I assume this is the update you are referring to

Phil



11
Hi Try

This code

        private EA.Connector createSequenceFlow(EA.Repository repository, Element source, Element target)
        {

            // Get corresponding elements from EA
            EA.Element EASource = repository.GetElementByGuid(source.Guid);
            EA.Element EATarget = repository.GetElementByGuid(target.Guid);

            EA.Connector sequenceFlowTo = EASource.Connectors.AddNew("", "BPMN2.0::SequenceFlow");
            sequenceFlowTo.SupplierID = EATarget.ElementID;
            sequenceFlowTo.Update();

            return sequenceFlowTo;
        }

This is written in C#, but you should be able to use to create your script

All the best#

Phil

12
General Board / Re: Sparx EA V13.5 Beta
« on: May 19, 2017, 07:27:03 am »
Yes great news indeed, I too received the e-mail, but did not see any download link for version 13.5 Beta 1

Is this only available from request to Sparx, or did I miss something?

Phil

13
Automation Interface, Add-Ins and Tools / Re: Insert a Legend
« on: April 19, 2017, 05:59:49 pm »
Following on from QWERTY's post

I have done this for a client using a script (jscript) and yes it is very convoluted.

Once you have deciphered the t_xref entry you then have to:

a) create a legend element
b) insert this entry into the t_xref table, which includes the link to the element created in a)
c) add the legend to the diagram

You will also have to investigate the type of element a legend is and discover a way to generate a GUID for the t_xref entry.

As there is no API to add directly into t_xref, I used the undocumented function execute on a SQL INSERT statement for the t_xref

Oh, the colours in the t_xref entry do not appear to be standard integer values from RGB!

As QWERTY suggested, create yourself a little eap create a diagram and then add a legend, then inspect the underlying tables. This is what I did to work it all out.

Best of luck!

Phil

14
General Board / Re: SysML Requirements - Copy relationship
« on: March 15, 2017, 10:19:17 am »
Hi

When a copy relationship is used between SysML requirements, the tagged value named text is copied.

Create a SysML requirement diagram and set element Tag compartment to be visible
Create a requirement and enter some text in the SysML tagged value, named text
Create a second requirement and relate to the first via Copy relationship
Note the value in the Text tagged value in the second requirement, it is the same as the first requirement and read only
Make a change to the text tagged value in the first requirement and notice the change is replicated in the second requirement

Phil

15
A method I used to set an automated orthogonal route was to set the Path property of each connector on the diagram.

Each connector was obtained from the DiagramLinks collection from a diagram and then for each DiagramLink element in the collection the Path was set.

The Path is the coordinates of the "Bend Points" in the form of a delimited string:

"Bend1X:Bend1Y;Bend2X:Bend2Y; ... BendNX:BendNY;"

I calculated the bend points using some offset constants which were then added or subtracted from the height / width of the elements I was starting to or from.

After changing the Path, the DiagramLinks collection was Refreshed and the diagram reloaded.

Hope this helps in some little way.

Phil

Pages: [1] 2 3 ... 36