Shapes Relations Manipulation Tool

Started by Yacine, December 11, 2015, 08:11:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

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
Yacine

Yacine

#1
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.
Yacine

Yacine

#2
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.
Yacine

Yacine

#3
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.
Yacine

Yacine

#4
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.
Yacine

Yacine

#5
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.
Yacine

wapperdude

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

I took the time to better present the tool.
Yacine

Yacine

Yacine

Yacine

Yacine

Yacine

Yacine

Yacine

Yacine

Yacine

And the nightly build version of the stencil with macros.
Yacine

Yacine

Got the metro script to work.

Step 1: setting up the background.
IF prop.hierarchydepth = 0 THEN
width:=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
IF prop.hierarchydepth = 1 THEN
prop.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.
IF prop.hierarchydepth = 1 THEN
LineWeight:=width/20;
LineColor:=[P]!fillforegnd;
LeftMargin:=LineWeight;
RightMargin:=LineWeight;
Fillforegnd:=HSL(HUE([L]!fillforegnd)+35,SAT([L]!fillforegnd),LUM([L]!fillforegnd));
ENDIF



Yacine

Yacine

 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