Author Topic: Shape Script - Cube with sides that won't stretch  (Read 11924 times)

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Shape Script - Cube with sides that won't stretch
« on: March 17, 2017, 11:39:18 pm »
Given:
  • I draw my own shape script, and the cube looks fine, but can't get it to behave the way I want.

What I want:
- When I stretch the shape, the top and right sides will not deform.
- When stretched vertically, the top side will not expand vertically.
- When stretched horizontally, the right side will not expand horizontally.

What It get:
- When stretched vertically, the top side expands vertically (but stays fixed to rectangle, nicely).
- When stretched horizontally, the top side expands horizontally (but stays fixed to rectangle, nicely).

What I've tried:
  • Using paths for the sides.
  • Using subshapes (with paths inside) for the sides.

I know this can be done in a shape script, but how?

Thanks.
« Last Edit: March 18, 2017, 12:19:15 am by adama »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape Script - Cube with sides that won't stretch
« Reply #1 on: March 18, 2017, 12:53:47 am »
1) I don't understand your question
2) It would help if you post your code

If you know a shape in one of the MDG's that behaves the way you want it you can find the shapescript code for it here: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

Geert

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #2 on: March 18, 2017, 03:12:29 am »
Geert, the issue is that the sides (parallelograms) expand when I resize the shape. I only want them to move with the base rectangle. Otherwise, the shape gets deformed. Here are screenshots

EXAMPLE
1. I used your code, which is exactly like mine. From https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/blob/master/Archimate2/ArchiMate_Node.shapeScript.

2. My Shape and UML::Node, each stretched horizontally. See the difference? Notice that your decoration does not get deformed.


3. My Shape and UML::Node, each stretched vertically. See the difference?


How does UML::Node, UML::Device, ZF::Location get the parallelograms to stretch in only one direction?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #3 on: March 18, 2017, 04:26:12 am »
You should use EITHER a decoration OR a shape. Not both at the same time.

q.

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #4 on: March 18, 2017, 05:05:18 am »
Of course, qwerty.  But, the purpose is to show the difference in how the shapes behave when they are stretched.  Style is not the issue, even though I agree with you.
Can you provide any feedback on the issue here?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #5 on: March 18, 2017, 06:48:15 am »
Well, it's not a bug, it's a feature. The shape is regarded  100x100 units. If you stretch it, your shape will be distorted similarly. IIRC there's an option somewhere to keep the x/x aspect equally. But aside of that, you are lost.

q.

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #6 on: March 18, 2017, 08:24:31 am »
Hmmm. Well, somehow they did it in UML::Node, UML::Device, ZF::Location, Archimate3::Device.  I know it can be done. But how?

Aspect ratio won't work, because it keeps x::y ratio.

I recently tried to work with decorations, but that didn't work either.

Looked at the MGDs provided with the software in the file system, but the shape scripts are encoded (rats).

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #7 on: March 18, 2017, 08:36:17 am »
A node is no shape script. It's build-in EA. You can extend UML::Node and use DrawNativeShape to get the same appearance.

q.

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #8 on: March 18, 2017, 10:30:39 am »
Understood qwerty. I've been down that road.  It works the same as single-inheritance from UML::Node.
Problem is, I have multiple inheritance that includes Archimate3::Node, which is 'stretchy'.  For some reason, IN ALL CASES OF MULTIPLE INHERITANCE INVOLVING ARCHI, my shapes inherit from the Archimate shape.  The only way for me to accomplish what I desire is to do single inheritance from UML::Node only.

So, I have to make a choice between two bad options: 1) use a stretchy shape; or 2) lose semantics.
Ugh.
Thanks!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #9 on: March 18, 2017, 07:28:42 pm »
If you use DrawMativeShape you should be done since I guess that Archimate also extends Node as meta class (hopefully).

q.

P.S. Obviously Archimate extends Class, not Node. So you are pissed :-/
« Last Edit: March 18, 2017, 07:32:06 pm by qwerty »

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #10 on: March 19, 2017, 08:57:26 pm »
Q, you hit the nail on the head.

To all, this is an interesting problem, because I have to balance competing concerns:
1) Model purity.
If doing the work for my EA team only, I would prefer model semantics, and thus would keep the inheritance to Archimate.

2) Communications with my customers.
But, I need these diagrams to communicate well with the business staff who I interact with. Thus, I decided that the shape is more important, and removed the inheritance to Archimate.  The orthographic projection (3D) appearance conveys the notion of physicality and containment better than the flat appearance of a rectangle, which is otherwise ubiquitous.

Ah, decisions, decisions. Cheers to all who helped and read this.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape Script - Cube with sides that won't stretch
« Reply #11 on: March 20, 2017, 07:13:46 pm »
There is something in shapescripts like "fixed" parts (I don't remember it's exact name), and border layout.
I think in this case, with the border layout you should be able to get the shape you want without it being stretched.
I did something similar in the RM Requirements shapescripts where I wanted the left part (with the text) to have a fixed width even when stretching the shape.

So in this case I think you have to define a north section and an east section and give them the parallellogram shape and a default size. Then when you stretch them they will not change stretch evenly and create the effect you are looking for.

Geert

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #12 on: March 31, 2017, 04:33:12 am »
Brilliant. I'll use your example and publish the script when I get around to it. Thanks!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #13 on: March 31, 2017, 05:48:55 am »
It's fixedAspectRatio and it can be set to true on top of the script.

q.

adama

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Shape Script - Cube with sides that won't stretch
« Reply #14 on: March 31, 2017, 08:54:32 am »
No, Qwerty, I don't want fixed aspect ratio.  Geert has the right idea.. I just didn't implement well.  I know it can be done from left to right, but not sure about left to right and top to bottom. We shall see when i get some time.