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 - KP

Pages: 1 ... 153 154 [155] 156 157 ... 167
A shape script can't query its element's size, but you can use the defSize(x,y); command to set the size. Units are pixels at 100% zoom. Example:

shape main

will create a circle not an oval.

Automation Interface, Add-Ins and Tools / Custom Compartments
« on: December 23, 2007, 05:15:39 pm »
Hi All,

I've been having a go at creating custom compartments. Here's some code (VB.Net) that seems to work - it creates a deployed artifacts compartment for node elements...
Code: [Select]

Function EA_QueryAvailableCompartments(ByVal Repository As EA.Repository) As Object
   EA_QueryAvailableCompartments = "deployed artifacts"
End Function

Function EA_GetCompartmentData(ByVal Repository As EA.Repository, ByVal sCompartment As String, ByVal sGUID As String, ByVal oType As EA.ObjectType) As Object
   If Repository Is Nothing Then
       EA_GetCompartmentData = ""
       Exit Function
   End If

   Dim el As EA.Element
   el = Repository.GetElementByGuid(sGUID)

   Dim sData As String = ""
   Dim sCompartmentData As String = ""

   If el.Type = "Node" Then
       Dim con As EA.Connector
       For Each con In el.Connectors
           If con.SupplierID = el.ElementID Then
               If (sCompartment = "deployed artifacts" And con.Type = "Deployment") Then
                   Dim art As EA.Element
                   art = Repository.GetElementByID(con.ClientID)
                   If art.Type = "Artifact" Then
                       sData = sData + "Data&_eq_^" + art.Name + "&_sc_^"
                       sData = sData + "GUID&_eq_^" + art.ElementGUID + "&_sc_^,"
                   End If
               End If
           End If

       If sData <> "" Then
           sCompartmentData = sCompartmentData + "Name=" + sCompartment + ";"
           sCompartmentData = sCompartmentData + "OwnerGUID=" + sGUID + ";"
           sCompartmentData = sCompartmentData + "Options=SkipIfOnDiagram&_eq_^1&_sc_^"
           sCompartmentData = sCompartmentData + "CompartmentData=" + sData + ";"
       End If
   End If
   EA_GetCompartmentData = sCompartmentData    
End Function

Happy holidays,


Automation Interface, Add-Ins and Tools / Re: Custom QuickLink Problems
« on: January 12, 2010, 09:20:21 am »
You don't want to use fully-qualified stereotypes: Say "mofsdmObject" not "MOFSDMElements::mofsdmObject".

Automation Interface, Add-Ins and Tools / Re: Custom QuickLink Problems
« on: January 12, 2010, 08:55:17 am »
Your document artifact named QuickLink has to be saved as part of a UML Profile. If you think you've done this, just check by opening your profile file in a text editor and looking for a <QuickLink> section towards the end of the file. The UML Profile can then be imported into your model or deployed as part of an MDG Technology.

It needs to be the technology ID, not name. If you open your technology XML file in a text editor, you will see the ID on the second line.

The way I would do this is: create a document artifact on a diagram and give it a linked document containing your template, save the diagram as a UML Pattern, include the UML Pattern in your MDG Technology, add an item to your custom toolbox to drop the UML Pattern onto a diagram. Instructions in help file. HTH.

It doesn't look like it can be done using the automation interface. Please send in a bug report and hopefully somebody can add it.

In the meantime, if you can establish a SQL connection to your model you can set it directly in the database. The field you would need to change is t_diagramobjects.ObjectStyle which contains a set of properties including "VPartition=0;" for horizontal partition (the default) or "VPartition=1;" for vertical.

There aren't any commands to, for example, create a profile from a given diagram/package or create a technology from a given MTS file (good ideas for a feature request), so you would have to write your own XML serialization. If you do, the potential sticking point will probably be base-64 encoding of shape scripts and bitmaps - I can't help you there, no idea how it's done.


But was not the question if it possible to hide symbols when exporting them? At least I want to show them on screen but when exporting removing certain elements.

// Magnus
Select the elements you want to appear in your diagram (hold down Ctrl and click the ones to select) then press Ctrl+C to copy the selected elements to the clipboard. Open a graphics application (MS Paint will do) and paste the clipboard into a new diagram. HTH

You can define a stereotype «invisible» that applies the following shape script:

Code: [Select]
shape main
If you set the stereotype's base class to '<all>' you can apply it to any element.

Regarding EA crashing, this needs investigating so please send in a bug report. Thanks.

Automation Interface, Add-Ins and Tools / Re: Toolbox Help
« on: December 04, 2009, 10:01:41 am »

No joy in fixing this yet...

Can a kind soul please post a simple example of a stereotype extending a metaclass that successfully drags from the toolbox?

Have a look in C:\Program Files\Sparx Systems\EA\MDGTechnologies. There's lots of examples in there.

Looking at your XML snippet, ProgrammeModelling is the name of your toolbox profile. Is it also the name of the UML Profile which contains the ZZZB stereotype?

As far I remember this was the thingey I didn't get to work. I've tried various versions for PPP and SSS, with full stereotype namespace, without, etc. But maybe I've just missed something. At least I ended up implementing the mentioned synch code, and that worked well.

If you were taking it from this post it is missing a semi-colon after the stereotype. Maybe that was the problem?

The answer is buried deep in one of the links that Günther gave you:
Code: [Select]
Repository.CustomCommand("Repository", "SynchProfile", "Profile=PPP;Stereotype=SSS;");
What this will do is search for all elements in the database with the stereotype «SSS» from profile "PPP" and bring their list of tagged values up-to-date. So if you are adding several stereotyped elements, just run this command once at the end.

I'd like to send a ZIP that contains the EA diagram, the modified template and an image of what I did in the template. How can I do this?

Pages: 1 ... 153 154 [155] 156 157 ... 167