Book a Demo

Author Topic: Sharing ShapeScripts  (Read 5576 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Sharing ShapeScripts
« on: April 29, 2009, 06:11:41 pm »
I'm sure there are others out there playing around with Shape Scripts.

I'm looking for a means to draw the component glyph - using a ShapeScript.  (I want to simulate a Packaging Component using a real Package (until Sparx upgrade the PackagingComponent functionality).

It seems to me that we could all profit from an additional section in the forums for shareable stuff (like shape scripts).

Obviously, I can develop one myself (and if no one shares, I'll do that) but if Sparx can come to the party it would be good...

PS: If Sparx provided a standard set of shape scripts for each of the glyphs they use that would make things REALLY consistent!  (Hint hint)  ;)

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Sharing ShapeScripts
« Reply #1 on: April 29, 2009, 09:16:06 pm »
There might be something in the works Paolo. I will write soon on the 'back channel' to discuss this. If you don't hear from me in the next little while please bug me on the subject.

David
No, you can't have it!

agdunn

  • EA User
  • **
  • Posts: 43
  • Karma: +0/-0
    • View Profile
Re: Sharing ShapeScripts
« Reply #2 on: April 29, 2009, 09:49:08 pm »
Would love to see this happen, I have recently been developing shape scripts for what our org needs. The 5 examples in Sparx documentation are just not enough.

Please get this rolling sparx, and paolo if they dont... maybe you and I should pump some code out, wouldn't be hard.
« Last Edit: April 29, 2009, 09:49:29 pm by irishdunn »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Sharing ShapeScripts
« Reply #3 on: April 30, 2009, 11:08:33 am »
Here's the component glyph...

I've set it up to be conditional on whether the element is a package or not...

Code: [Select]
shape main
{
      drawnativeshape();
      if (hasproperty("type", "Package"))
      {
            setorigin("NE",-20,5);
            addsubshape("PackagingComponent", 0, 0);
      }
      Shape PackagingComponent
      {
            scalable = false;
            Rectangle(0,0,15,25);
            Rectangle(-5,5,5,10);
            Rectangle(-5,15,5,20);
      }
}
Couple of issues:
1) The subshape changes aspect ratio with the change in aspect ratio of the base nativeshape.  (whereas the proper component glyph doesn't) Fixed as a result of post below - NEW code supplied!
2) For some elements, I get slightly differnet renderings - not sure why yet.  (But I'm pretty sure it's related to EAUI wrt to the three different ways to specify element rendering.

Enjoy,
Paolo
« Last Edit: May 01, 2009, 11:24:06 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Sharing ShapeScripts
« Reply #4 on: May 01, 2009, 02:00:59 am »
Hi Paolo,

I think there was an easy way to prevent subshapes from scaling, just setting shape attribute 'scalable' to false in the subshapes definition.

WBR
Günther
« Last Edit: May 01, 2009, 02:01:29 am by Makulik »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Sharing ShapeScripts
« Reply #5 on: May 01, 2009, 11:20:48 am »
Quote
Hi Paolo,

I think there was an easy way to prevent subshapes from scaling, just setting shape attribute 'scalable' to false in the subshapes definition.

WBR
Günther
Thanks Günther,

As you can see, I've changed the code above (and as a result had to adjust the sizings...).  The new shape looks really good!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Sharing ShapeScripts
« Reply #6 on: May 04, 2009, 08:29:15 am »
For this concept to get very far, we really need to see some of those many enhancements to shape scripts we have asked for.  I see no reason why shape scripts can't be extended ... and not with huge effort ... such that everything we see is basically the result of an underlying shapescript rather than something hard coded.  And, once we have that, then we can have source for them, subclass them, etc. in the way we have been requesting for some time.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Sharing ShapeScripts
« Reply #7 on: May 19, 2009, 01:27:00 pm »
Quote
For this concept to get very far, we really need to see some of those many enhancements to shape scripts we have asked for.  ...
Indeed!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!