### Author Topic: Shapes Relations Manipulation Tool  (Read 14305 times)

0 Members and 1 Guest are viewing this topic.

#### Yacine

• Hero Member
• Posts: 2703
##### Shapes Relations Manipulation Tool
« on: December 11, 2015, 03:11:42 PM »
Hi guys,
I've been working on this for quite a while now.
It's a tool that allows to set up formulas between shapes from a dialog.
A parser is built in so you can write freely scripts to modify your drawings.
Let me know if the presentation I prepared is somehow understandable and what you think about the tool.

Cheers,
Yacine
« Last Edit: December 11, 2015, 03:33:55 PM by Yacine »
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #1 on: December 11, 2015, 03:12:21 PM »
The first example shows a tabular arrangement of shapes using the modulus function.

The second shows the built-in random function. [?] translates in a random number between -0.5 and +0.5. So you can add a bit of chaos to your drawings.
« Last Edit: December 11, 2015, 03:44:15 PM by Yacine »
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #2 on: December 11, 2015, 03:12:58 PM »
Here I tried to get radial arrangement of shapes. But the result is not yet as expected.

And then the magical Junichi chain. I coloured it and made the width of the next shape each time smaller. Move the first shape and enjoy playing.
« Last Edit: December 11, 2015, 03:42:10 PM by Yacine »
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #3 on: December 11, 2015, 03:29:33 PM »
Keeping Junichi's idea in mind, I modified the formulas so, that several shapes can follow one parent.
Drag the end of a connector to modify the drawing.

In the second example, I injected a formula that sums values of the child shapes and translates the result in a line weight. So basically the beginning of a Sankey tool.
« Last Edit: December 11, 2015, 03:50:37 PM by Yacine »
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #4 on: December 11, 2015, 03:29:58 PM »
This one is a neat example that shows how to format a complete graph with only one script.
If I had used guard functions on the formulas, it would have been the adaptation of V2010's containers and lists for V2007.
« Last Edit: December 11, 2015, 03:52:05 PM by Yacine »
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #5 on: December 11, 2015, 03:32:28 PM »
And here are the visio files.
I would be glad if the tool could get mature and be available as stable tool to download from somewhere. Github?
I welcome everybody to colaborate.

Cheers,
Y.
« Last Edit: December 11, 2015, 03:49:17 PM by Yacine »
Yacine

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 3822
• Ideas Visio-lized into solutions
##### Re: Shapes Relations Manipulation Tool
« Reply #6 on: December 11, 2015, 04:25:49 PM »
Looks very interesting.  Will have to "play" with it to fully appreciate your effort and the capabilities that you've captured.

Looking forward to exploring...

Wapperdude
Visio 2019 Pro

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #7 on: December 13, 2015, 01:50:45 PM »
I took the time to better present the tool.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #8 on: December 13, 2015, 01:52:22 PM »
.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #9 on: December 13, 2015, 01:52:57 PM »
.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #10 on: December 13, 2015, 01:53:28 PM »
.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #11 on: December 13, 2015, 01:54:17 PM »
.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #12 on: December 13, 2015, 01:55:33 PM »
And the nightly build version of the stencil with macros.
Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #13 on: December 14, 2015, 03:22:13 AM »
Got the metro script to work.

Step 1: setting up the background.
Code
``IF prop.hierarchydepth = 0 THENwidth:=thepage!pagewidth-20mm;height:=ThePage!PageHeight-20 mm;pinx:=thepage!pagewidth/2;piny:=thepage!pageheight/2;LeftMargin:=10pt;TopMargin:=10pt;ENDIF``

Step 2: Define size and position of the shapes at hierarchyDepth=1
Code
``IF prop.hierarchydepth = 1 THENprop.sort := [L]!prop.sort+1;height:=if(modulus(prop.sort,3)=0,150mm,75mm);width:=if(modulus(prop.sort,3)=0,60mm,70mm);locPinX:=width*0;locPinY:=height*0;pinX:=if(modulus(prop.sort,3)=0,if(len(prop.leftsibling)>0,[L]!pinX+[L]!width,10mm),if(modulus(prop.sort,3)=1,[L]!PinX+[L]!width,[L]!PinX));pinY:=if(modulus(prop.sort,3)=2,[L]!PinY+height,if(modulus(prop.sort,3)=1,[L]!PinY,[L]!PinY-[L]!height));ENDIF``

Step 3: Added some cosmetic features to color the shapes.
Don't be surprised by getting white shapes, when you run the script. I did not handle the condition where the leftsibling is empty.
So re-colour the first shape to see the colours of its siblings change.
The gap between the shapes is simply given by a thicker line weight with the same colour as the parent.
Code
``IF prop.hierarchydepth = 1 THENLineWeight:=width/20;LineColor:=[P]!fillforegnd;LeftMargin:=LineWeight;RightMargin:=LineWeight;Fillforegnd:=HSL(HUE([L]!fillforegnd)+35,SAT([L]!fillforegnd),LUM([L]!fillforegnd));ENDIF``

Yacine

#### Yacine

• Hero Member
• Posts: 2703
##### Re: Shapes Relations Manipulation Tool
« Reply #14 on: December 15, 2015, 08:11:14 AM »
I introduced new placeholders:
[PrSel] for the previous shape in the selection,
[NxSel] for the next shape,
[NumSel] for the number of shapes selected,
[Sel1] for the first selected shape and
[lastSel] for the last selected shape.

With these new placeholders arbitrary and non prepared shapes can be handled by the tool.
PinX:=[PrSel]!PinX+[PreSel]!width/2+width/2+10mm;
Would arrange the shapes in the selection with a gap of 10 mm in between.
Yacine