Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: DAVEDEWEY on September 28, 2017, 06:56:43 PM

Title: SHAPE PROGRAMMING
Post by: DAVEDEWEY on September 28, 2017, 06:56:43 PM
Had a great response to my last post now have shapes that I sort of know how to make intelligent,, is there a good guide or quick view list of commands variables that can be added to smart shapes anywhere
Title: Re: SHAPE PROGRAMMING
Post by: Surrogate on September 28, 2017, 07:16:37 PM
You need learn ShapeSheet basics!
For example Understanding the ShapeSheet  (https://msdn.microsoft.com/en-us/library/office/gg144579%28v=office.14%29.aspx?f=255&MSPPError=-2147217396)
Title: Re: SHAPE PROGRAMMING
Post by: wapperdude on September 28, 2017, 08:08:23 PM
Add another reference in addition to Surrogate's:  https://msdn.microsoft.com/en-us/library/office/jj945061.aspx (https://msdn.microsoft.com/en-us/library/office/jj945061.aspx)

Wapperdude
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 01, 2017, 12:46:12 PM
hey guys thanks for that sort of getting there I think

so I have 4 menu items saying
open
closed
earth in
earth out

open and close works lovely changing colours as i need, there is then part of the shape that stays white untill i select earth in

=IF(Sheet.5!Scratch.A1=1,THEMEGUARD(RGB(0,0,0)),THEMEGUARD(RGB(0,0,0)))
=IF(Sheet.5!Scratch.A1=0,THEMEGUARD(RGB(0,0,0)),THEMEGUARD(RGB(0,0,0)))

=IF(Sheet.5!Scratch.A2=0,THEMEGUARD(RGB(0,255,0)),THEMEGUARD(RGB(0,0,0)))

as you can see im using scratch, i think the real problem is that im using lots of ifs any ideas please


Title: Re: SHAPE PROGRAMMING
Post by: wapperdude on October 01, 2017, 11:02:50 PM
There's a lot of information missing.  Difficult to help.  Easiest would be to upload your shape.

But...
Under what conditions does the shape stay white?  How are those conditions defined?  The sheet.5!scratch cells???  Under what conditions does the shape change to some other color? 

Where are the IF statements located...what cell?

The 1st two IF statements do the same thing regardless if the test condition is true or false.  Thus, they are not necessary as is, and you might as well hardcode the RGB value.  Only the 3rd IF statement does something meaningful.

Wapperdude
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 03, 2017, 07:13:40 AM
The shape in the attached "HV BREAKER" has menu options closed to supply, open, closed to earth, open

Closed to supply the shape remains red the earth is not shown
Open shape turns black earth not shown
Closed to earth shape remains black but earth symbol shows going from white to green
open was to remove earth but in fairness this could go white if either of the first two were then pressed
Title: Re: SHAPE PROGRAMMING
Post by: Yacine on October 03, 2017, 11:30:25 AM
Can you show each combination individually?
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 03, 2017, 12:03:24 PM
For sets copied here in real terms there is no needs for open from earth as this could be a toggle of closed to earth or open from supply

Title: Re: SHAPE PROGRAMMING
Post by: Yacine on October 03, 2017, 02:20:51 PM
Nut sure whether I got every thing right ... check the attachment.

The things I modified:
- scratch section
this is fine, but not really needed. This section has several columns, one can use for properties (A and B), coordinates, etc.
In your case, you're just looking for a boolean checked/not checked, so I replaced the scratch cells by user cells. A pure "esthetical" issue.

- the sub shapes were far too complex, I replaced them by 2 shapes.
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 03, 2017, 04:21:41 PM
thats very good thank could i ask what section do i find you formulas in
Title: Re: SHAPE PROGRAMMING
Post by: wapperdude on October 03, 2017, 06:52:18 PM
For Yacine's shape, there are formulas in the Actions section at the toplevel, group shape.
There is a formula in the LineColor of the Supply subshape, and a formula in the LineColor for the Earth subshape.  These are controlled by the User.Supply and User.Earth entries in the toplevel group shape.

In the attached, a variation is provided to show further possible consolidations.  As shown, the Supply and the Earth shapes, have reduced geometry sections.

In addition, the overall structure can be reduced from the current group plus 2 subshapes to a group and one subshape.  The trick is to convert the Supply shape to a group.  All of the Actions are still part of the group as before.  Except for the fact that the Earth has a unique color, the entire structure could have been done in a single shape using appropriate geometry sections to control on/off visibility.  But everything would have identical colors...when black, all lines are black, when red, all lines are red.

Finally, for hiding the Earth subshape, rather than changing it's line color, I use the Geometry1.noshow cell.

Mostly, the idea was to show that a lot is possible via the shapesheet.

Wapperdude
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 05, 2017, 11:50:11 AM
These are really good guys, so what would the easiest way be to prevent the earth showing if the shap is closed to supply
Title: Re: SHAPE PROGRAMMING
Post by: wapperdude on October 05, 2017, 01:42:46 PM
Just to be clear, whenever the closed supply is shown, you never want the earth symbol to show?  Then, assuming there are 2 scenarios that hide the earth symbol...

In the shape I provided, you can use an OR statement inside the IF in the Geometry1.noshow cell.  Since "true" or "1" hides the geometry, something like =IF(OR(A,B),1,0), where A is the closed supply condition and B is the no earth condition.

The same IF statement approach would be true for Yacine's development.

Wapperdude
Title: Re: SHAPE PROGRAMMING
Post by: DAVEDEWEY on October 06, 2017, 09:45:21 AM
i will have a go cheers guys