Book a Demo

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Hello all,

In EA 17.1, I maintain an MDG Technology in which about 100 stereotypes extend Class. Each draws an Azure service icon, a square PNG stored in the technology's images, with the name underneath. All of them use the same shape script:

Code: [Select]
shape main
{
    layouttype="border";
    noshadow=true;
    fixedaspectratio=true;
    defsize(79,90);
    image("Azure_Firewall",10,0,90,70);
    addsubshape("S","S");
    shape S
    {
        preferredheight=26;
        v_align="top";
        h_align="center";
        printwrapped("#name#");
    }
}

In the normal view, the icon keeps its aspect ratio.

When Info View is enabled on the element, EA draws the same script as a small icon at the top right of the info box. That icon is squashed horizontally: the square firewall image comes out at about 39 x 20 px. EA seems to render shape main in a frame that is roughly twice as wide as it is high, and to ignore fixedaspectratio there.

What I tried
  • Branching on rectangle notation:
Code: [Select]
if(hasproperty("rectanglenotation","1")) { image(...,25,0,75,100); }
else { image(...,10,0,90,70); ... }
    This fixes Info View, but the normal view also takes the first branch, so the icon is stretched vertically and the name disappears. Both views appear to return the same value.[/li]

  • A separate shape icon { ... } section: EA ignores it in Info View.
  • Comparing diagram objects: in t_diagramobjects.ObjectStyle, the only difference is that the Info View objects lack UCRect=1. I found no shape-script property that exposes this.

Questions
  • Is there a property or query method that tells a shape script it is being drawn as the Info View icon, such as a hasproperty(...) value?
  • Alternatively, is there a supported way to give a stereotype a separate icon for Info View, or to make EA keep the aspect ratio of image() in that frame?

Thanks in advance.

Eric
12
I know you've been told that updating locked items for any reason is a hard no. It is a clear anti-pattern and will cause data integrity issues.

Adding a new permission doesn't address your problem in any way and wouldn't solve any of the issues that would cause.

An administrator already has the capability to remove locks that users have applied. You can do what you want with that.
13
It would also be useful if the othe MS SQL query expressions were allowed at the beginning of the text for instance common table expressions begin with "With" for example:
From https://learn.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql?view=sql-server-ver17

-- Define the CTE expression name and column list.
WITH Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
AS
-- Define the CTE query.
(
    SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
    FROM Sales.SalesOrderHeader
    WHERE SalesPersonID IS NOT NULL
)
-- Define the outer query referencing the CTE name.
SELECT SalesPersonID,
       COUNT(SalesOrderID) AS TotalSales,
       SalesYear
FROM Sales_CTE
GROUP BY SalesYear, SalesPersonID
ORDER BY SalesPersonID, SalesYear;

This simplifies queries and would be really useful in Prolaborate too
14
Alternative solution: New security permission “Security – Manage Metadata”, for example.

Users with this permission can make changes to items even when items are locked (locks are ignored)
Items can be elements, connectors, diagrams, packages including properties, typically
-   property/tagged value sets (add, delete, rename properties)
-   stereotypes and types of elements, connectors, diagrams, and packages

Important: When changing type or stereotype, existing property values should not be deleted, changed, or emptied
15
Thanks Eve, I had forgotten the View Specification method.

To Roy

I have tried a simple MDG using the View Specification technique and confirm that it works.

Please send a Personal Message on this forum include your e-mail and I can send you my example MDG together with a simple test repository.

Phil
16
The only way you can define your own diagram profile and have it inherit the SysML behavior is via an add-in that implements the EARules_Initialize broadcast.

Pseudo code would look like this:
Code: [Select]
string EARules_Initialize([in] Repository repository, [in] int index, [out] string base)
{
    switch(index)
    {
    case 0:
        base="SysML1.4";
        return "MyStereotypeProfile";
    case 1:
        base="SysML1.4";
        return "MyDiagramProfile";
    default:
        return "";
    }
}

If those two profiles have the same name then you can omit the second.

This can be implemented in a model add-in which can be marked as enabled for all users.

When EA asks if it knows about any special rules that can't be defined in a profile for the current diagram or element it will find your types. It would then call your add-in for the broadcasts in the documentation. If you haven't implemented one of those or for any of the others we don't have published it will then fall back to the SysML 1.5 behavior.

The other option that you have is to define a view definition on top of the existing diagram type. There's even an example in the help for how to define a view extending a non-UML diagram.

I'm guessing Phil's suggestion to add ShowFrame and HideFrame (along with the extension attribute) came from an LLM. If it's going to work you'll have to use the option as named in the existing values, but you already said that it didn't work with SF.
17
Hi Again

I am trying to see if I can get this to work, but no luck so far.

Disclaimer, all the advice offered so far was from searching various sources rather than something I had achieved for myself.

I will keep trying but may not be able to post further until tomorrow.

Phil
18
Hi Phil, thanks again.

I tried your solution but it doesn't have the desired effect. The generated XML of the MDG shows the fields you described.

Code: [Select]
<Stereotype name="CustomActivity" notes="" cx="0" cy="0" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0">
<AppliesTo>
<Apply type="Diagram_Activity">
<Property name="toolbox" value="xxxxx"/>
<Property name="extension" value="SysML1.4"/>
<Property name="styleex" value="ShowFrame=1;"/>
<Property name="pdata" value="HideFrame=0;"/>
</Apply>
</AppliesTo>
</Stereotype>

I also tried the SysML 1.5 variant.
When I query the diagram I don't see anything about the attribute extension or the value SysML1.4 or SysML1.5.

Did this construction worked in your environment?

Roy
19
I have done a bit more digging and found:

If you extended UML::Activity directly, Sparx treats your custom diagram as a standard UML diagram, stripping away the mandatory SysML frame.
• Open your MDG Diagram Profile development package.
• Ensure your custom diagram stereotype extends the SysML Metaclass/Stereotype rather than the core UML one.
• Instead of mapping to Metaclass: Diagram_Activity, verify it accurately maps to the SysML profile diagram definitions, or explicitly uses the SysML stereotype.

I believe you said in your initial post that you had extended UML::Activity, it appears that maybe the underlying cause of your issue.

1. Use an Extension connector from your custom diagram stereotype (MyCustomSysMLActivity) pointing directly to the modified Diagram_Activity Metaclass.
2. (Optional) Add a frameString attribute to your stereotype element if you want to customize the text rendered in the top-left corner of the SysML frame (e.g., act [Activity] MyCustomHeader).
 +--------------------------------+                  +---------------------------------+
 |        «stereotype»                |  Extension   |          «metaclass»                |
 |   MyCustomSysMLActivity     |------------->|       Diagram_Activity             |
 +--------------------------------+                  +----------------------------------+
                                                                 | extension = SysML1.5            |
                                                                 | styleex   = ShowFrame=1;     |
                                                                 | pdata     = HideFrame=0;      |
                                                                +---------------------------------+

Where the attributes are defined as:

• extension: Set this to the version of SysML your MDG targets (e.g., SysML1.4 or SysML1.5).
• styleex: Set this to ShowFrame=1; (This forces the native SysML diagram frame layout to always render on initialization).
• pdata: Set this to HideFrame=0; (Ensures frame visibilities are on by default).

Interestingly this states ShowFrame / HideFrame rather than SF

But I guess anything is worth a try !

Best of luck

Phil
20
No it didn't but after I added MDGDgm=SysML1.4::Activity; to StyleEx it still doesn't work.

I even tried to copy the whole StyleEx from a SysML activity diagram to my profile without effect.

Maybe the problem is that I now have two MDGGgm variables in my StyleEx which are MDGDgm=My Diagrams::Activity and MDGDgm=SysML1.4::Activity. EA Automatically added the first entry based on my profile.
Pages: 1 [2] 3 4 ... 10