Trying to create a shape script

78 views
Skip to first unread message

Selvy@localhost Brian Selvy

unread,
Apr 6, 2015, 1:56:51 PM4/6/15
to sparx-enterprise-archite...@googlegroups.com
I'm using the "Profile Helper" to create a custom Use Case element along with an associated Toolbox.  The custom Use Case element extends the default Use Case with several additional custom tagged values, some of which are associated with custom enumerations.  

My goal is to also create a custom look for the new element so that anyone browsing the model can visually identify quickly the custom Use Cases vs. the standard Use Cases on diagrams.  

To do this, I've been trying to play around with Shape Scripts, but this has really been a frustrating experience.  My desire is simply to take the default ellipse shape for a normal Use Case and just put a slightly smaller ellipse inside it for my custom Use Case, which has the effect of just creating a doubled lined border.  

I found on the EA website some example scripts:  http://www.sparxsystems.com/enterprise_architect_user_guide/12.0/extending_uml_models/example_scripts.html#comp

So, I decided to take a part of one example and tried this:

shape main
{
startpath();
ellipse(0,0,100,100);
endpath();
fillandstrokepath();
ellipse(3,3,97,97);
}


However, that results in the element's label (name) not being displayed on a diagram.  I suspect that this is because the inner ellipse is "fill and stroke", so the inner ellipse is color filed (same as the default so it's hard to see, but that's my suspicion).

So, then I try to add some additional code to re-add a label:

shape main
{
startpath();
ellipse(0,0,100,100);
endpath();
fillandstrokepath();
ellipse(3,3,97,97);
}
shape label
{
setOrigin("SW",50,50);
println("#NAME#");
}


I can't find any reference anywhere to what the "SW" means (again, I'm stealing from an example).  I want the label to be centered in the object.

Does anyone know what I'm doing wrong?  Is there a much simpler way to accomplish what I need?  Again, my goal is just to have an ellipse with essentially a double line boarder.

Thanks,

Brian

[original message]

Selvy@localhost Brian Selvy

unread,
Apr 6, 2015, 2:37:00 PM4/6/15
to sparx-enterprise-archite...@googlegroups.com
Reviewing the EA Profile Helper video (http://www.sparxsystems.com.au/resources/demos/profile-helpers/profile-helpers.htm), and stopping the video right where the author briefly shows the shape script screen (around 3:49 into the video), I was able to see what I was essentially missing: the ability to add the native shape.  So, here's what I came up with (added some color too), which works for me:

shape main{
     //Draw Outer Elipse      
     SetFillColor(51,153,255);
     SetPenColor(GetUserBorderColor());
     ellipse(-3,-3,103,103);
     SetFillColor(GetUserFillColor());
     SetPenColor(GetUserBorderColor());

     // Original Element
     drawnativeshape();
}

[original message]
Reply all
Reply to author
Forward
0 new messages