Visio Guy

Visio Discussions => General Visio => Topic started by: neilmac on April 21, 2010, 02:07:15 PM

Title: Conditional format Simple Square or Circle
Post by: neilmac on April 21, 2010, 02:07:15 PM
Good afternoon everyone, and thank you for such a great forum.

I am making a visio diagram of a Cisco Switch network, and I would like to colour code the VLANS on each switch port. I don't think it's possible within the Cisco shape, so I thought I would create a simple circle or square to go over each port on the switch.

I will enter the values of 1,2,3,4,5 etc for each port according to the VLAN membership.

Please would anyone tell me how I can get the shape fill colour to change based on the number I place in the shape ? For example, number 1 makes the shape fill red, number 2 fills blue and so on.

Any suggestions gratefully appreciated.

Many thanks,

NSM
Title: Re: Conditional format Simple Square or Circle
Post by: vojo on April 21, 2010, 02:22:33 PM
first your answer

1. layout all the boxes where you want them on the circle
2. group them
3. add custom props to your group shape.....props.vlan1....props.vlan2....props.vlan3...etc
    set group shape eventdblclk = docmd(1312)
4. in each box (subshape of the group), set fillforegnd = if(sheet.x!props.vlanv<vlan of interest> = <num of interest>, RGB (R,G,B), RGB (100,100,100)
    (R,G,B are the red green blue elements of the color you desire....gives you better control than just say 0 or 1 or 5...they work, just no control to tune it).
    You can nest these or use a user cell to help with the nesting....I.e. if (x=y, if (a=b, if (q=r, ans1,ans2), ans3), if(m=n, ans4, ans5))
    can also use the lookup function if you want to get fancy
5. Now done...so try it out....double click the group....set the vlans as appropriate...voila subshape squares change color

Now the next thing you will want to think about
- probably want some connection points on those squares so that if you move the group around...lines follow
- since cisco stuff is usually iso or 2.5 iso...may want to start with that shape and put your boxes over top....viso cafe has usual cast of characters in visio format
  (can get cisco shapes from cisco directly)...using cisco shapes would also allow you to have additional info already coded...location of switch, SN, etc

Good luck
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 21, 2010, 02:39:21 PM
Thanks, Vojo, that's pretty detailed.

I will have a go, just want to check a couple of things - I need this to work per port not as a group.

I will only enter values 1,2,3,4 etc, not VLAN1, VLAN2.

Can I make one, then copy and paste and it retains the formatting ?

Thanks,

NSM
Title: Re: Conditional format Simple Square or Circle
Post by: vojo on April 21, 2010, 03:52:05 PM
yes....all your requirements met....I do that all the time
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 21, 2010, 04:48:47 PM
Vojo,

Thanks again.

I hate to ask, however I am really struggling with this, I wonder if you wouldn't mind sending me an example that I can open up and amend, to understand a bit better what's involved ?

Would that be ok ?

NSM
Title: Re: Conditional format Simple Square or Circle
Post by: vojo on April 21, 2010, 05:25:35 PM
here you go
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 21, 2010, 05:36:15 PM
Thanks for that, however not quite what I meant - I am sorry for not explaining better. In excel for example, I can apply conditional formatting to a cell, input a number in the cell and the colour will change accordingly.

For Visio, I just need a single simple shape, either a circle or a square.

If I put a 1 in the square (or circle) it goes red, 2, it goes blue, etc.

If I change the numbers in the sample you sent, the colours don't change.

I do appreciate the help, and again I am sorry for not explaining better.

Is there a simpler option ?

Thanks again,

NSM
Title: Re: Conditional format Simple Square or Circle
Post by: wapperdude on April 21, 2010, 05:56:47 PM
Strange...the colors changed for me. 

Select the group shape, don't select the subshape.  Then right click > Data > Shape Data.  Brings up a form with three entries.  Each entry has a drop-down menu to select a number.  Change the number and the corresponding circle color changes.

Were you wanting to enter the number directly into the subshape rather than via a data form?

Wapperdude
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 21, 2010, 06:03:48 PM
Ahh, got you....

Yeah, I was hoping just to enter a number and the format would go automatically as it does in Excel.

Title: Re: Conditional format Simple Square or Circle
Post by: vojo on April 21, 2010, 07:03:58 PM
it does....double click the shape....type what number in appropriate VLAN entry....color changes automatically.

you are going to want to do it this way.

you could use just text but with a group of shapes its going to get pretty unusable
(need to tie specific text to shape, if number in the little circles then hard to read, need to use if(strsame(thetext, "<value>"), color, default)  kind of construct, etc.)

More over as I said...you quite likely to want additional info...and custom props is where that is best placed
(can export more easily to DB or excell, can generate reports, etc).

But fill free to poke at this all you want
Title: Re: Conditional format Simple Square or Circle
Post by: wapperdude on April 21, 2010, 07:07:31 PM
A quick and dirty solution is attached.  You can incorporate some of Vojo's features, e.g., using index function, etc.  The key to this solution is using "shapetext(TheText)" to read what is typed in.  Set the character transparency to 100% if you don't want to see any text.

Vojo's solution is much more elegant.

HTH
Wapperdude
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 22, 2010, 09:28:09 AM
Thanks, Wapperdude.

That's exactly it, I am trying to get into it to edit it and play with it. I have been looking for more than an hour and can't find where to amend the FillForegnd attribute, would you mind giving me a pointer ?

Thanks,

NSM
Title: Re: Conditional format Simple Square or Circle
Post by: Aeon on April 22, 2010, 09:32:38 AM
in addition to wapperdude: or just set hidetext (under miscellaneous) to true

@neil: if you want just send the drawing and i'll look at it, got time on my hands atm anyways

if you can tell me what cisco shapes you are using i could try to adapt them so you can colour each port.
i managed to colour a UPS from the default visio drawings so i don't see why it wouldn't work here
Title: Re: Conditional format Simple Square or Circle
Post by: wapperdude on April 22, 2010, 02:30:36 PM
Hi NSM --

In the shapesheet (menu bar > Window > Show Shapesheet), scroll down to the Fill Section.  It is almost always present.  If not, you can right click in the shapesheet to pop up a menu.  Either choose Insert Section or View Sections and click the Fill Section to see it.  As for the text transparency, that can also be set from the shapesheet -- since you're there.  It's in the Char Section.

Note:  you can also toggle the format of the shapesheet to see either the values in each of the cell blocks, or the formulas.  Again right click and check either values or formulas.

Nice shapesheet reference is here:  http://msdn.microsoft.com/en-us/library/ms427024(v=office.12).aspx

and VisioGuy has a host of articles on shapesheet related topics.  You might want to start here:  http://www.visguy.com/category/development/shapesheet/page/2/

HTH
Wapperdude
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 26, 2010, 12:08:26 PM
Quote from: Aeon on April 22, 2010, 09:32:38 AM
in addition to wapperdude: or just set hidetext (under miscellaneous) to true

@neil: if you want just send the drawing and i'll look at it, got time on my hands atm anyways

if you can tell me what cisco shapes you are using i could try to adapt them so you can colour each port.
i managed to colour a UPS from the default visio drawings so i don't see why it wouldn't work here

Thanks again to you all, Aeon - if you're still up for a challenge...

I have a number of switches, all WS-3750E, some 24 port (PD and TD) , some 48 ports (PD and PDF). I have a number of VLANS, and it may change, see attached graphic for colours. The shut port is represented by an "x" (that would be the text entry). The 4+1 port is the IP phone where the phone is on VLAN for and the nativeis on VLAN 1. Don't worry if you don't know about the vlans, it's just that the text entry changes.

All as I would like is to be able to easily change the colours on the ports on the visio of the switch. I like the original idea where you can open a master property sheet, but I haven't been able to replicate it.

Any thoughts ?

Title: Re: Conditional format Simple Square or Circle
Post by: Aeon on April 26, 2010, 12:38:30 PM
so if you input 15.1 it should be the same colour as if it were 15 right? just checking,

i'll start on it

PS: found the PD and TD (24 port) ones aswell as the PD 48 port, but not the PDF one


edit update: the cisco stencils were plain images, so i had to recreate the ports and overlay them on the original image.
so far: ports 1-6 work, need to copy paste for the other 42 ports (tomorrow, right now i'm going home)
Title: Re: Conditional format Simple Square or Circle
Post by: vojo on April 26, 2010, 03:19:27 PM
an off the wall idea....since you are looking at a front / real view....why not just color code the cables or links?
Would save you the work of tweaking the stencil and probably would be less busy than color squares partially obscured cables/links.

( I doubt you are really considering trying to put 42 connections on a one of the logical stencil shapes   ;) ;) ;)  ....that would be call self flagilation)
Title: Re: Conditional format Simple Square or Circle
Post by: Aeon on April 27, 2010, 01:56:04 PM
got the switches ready, but the stencil is too large to upload.

let me know something if you want it
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on April 27, 2010, 03:52:21 PM
Excellent, can you pando it ?

:>)

Neil at Harryboo dot com
Title: Re: Conditional format Simple Square or Circle
Post by: neilmac on May 02, 2010, 05:53:55 PM
Excellent - I have just picked up the stencils and I',m having a play, that's fantastic work, thank you.

I can only see up to number 20 when I view properties, do you know how to get to the ports above that ?
Title: Re: Conditional format Simple Square or Circle
Post by: vojo on May 02, 2010, 09:25:15 PM
custom props display is limited to something like 20-25 entries.....need to index to show subsets

something like

action 1: setf(getref(user.index), 1) + docmd(1312)
action 2: setf(getref(user.index), 2) + docmd(1312)

props.data1.invisible = if(index=1, false, true)

props.data20.invisible = if(index=1, false, true)
props.data21.invisible = if(index=2, false, true)

props.data40.invisbille = if(index=2, false, true)
etc.

Can somebody put up a png or jpeg of these shapes....I want to know why I lost out on a beer ;-)