Is there a more elegant way to pull apart a text string in the Shapesheet?

Started by miless2111s, January 29, 2022, 04:38:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

miless2111s

I want to pass across to Visio a series of "co-ordinates" for geometries of a shape in one of the Shape data fields.  So for a simple chevron, I would pass across:
width*0,height*0
1cm,height*0.5
width*0,height*1
width-1cm,height*1
width,height*0.5
width-1cm,height*0
width*0,height*0

I would want to be able to pass over more complex shapes which Visio doesn't offer so there would be other corner points but they would be stacked up under the 0,0 position.

I had in mind using a long string with each pair separated by a character and then pulling out the pairs into a field before splitting the pairs in the action Geometry section of the shape sheet.  The splitting would be done using Find and maybe Substitute to find the 2nd, 3rd etc locations for the splitting but I wondered if there was a more elegant way to do it?

At the moment I have:
In Prop.row_1 = ="width*0,height*0|1cm,height*0.5|width*0,height*1|width-1cm,height*1|width,height*0.5|width-1cm,height*0|width*0,height*0"
In Prop.row_2 =LEFT(Prop.Row_1,FIND("|",Prop.Row_1)-1)
in Pro.row_3 = =MID(Prop.Row_1,FIND(CHAR(160),SUBSTITUTE(Prop.Row_1,"|",CHAR(160),1))+1,FIND(CHAR(160),SUBSTITUTE(Prop.Row_1,"|",CHAR(160),2))-FIND(CHAR(160),SUBSTITUTE(Prop.Row_1,"|",CHAR(160),1))-1)
and so on until I use a right to pull out the last expression.

Then in Geometry 1 X = =LEFT(Prop.Row_2,FIND(",",Prop.Row_2)-1) and Y =RIGHT(Prop.Row_2,LEN(Prop.Row_2)-FIND(",",Prop.Row_2))
and so on down all the "corners" of the shape.

This works but I wonder if there is a more elegant way....