Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: skydiver13 on May 25, 2017, 07:20:02 PM

Title: Help Creating a Custom Shape
Post by: skydiver13 on May 25, 2017, 07:20:02 PM
Hello.  I am trying to create a shape similar to a SPST switch which is already created in visio. I would like create a shape to have similar functions, whereas I would right click and press show closed circuit or press show open circuit. Does any one know how to create a shape where I would right click and press show pic 1 and than right click and press show pic2. Any help would be appreciated. Thanks in advance.
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 25, 2017, 08:35:43 PM
Hi Skydiver13...

First, please don't double post, not necessary and makes responding difficult.

To your topic...certainly doable.  Which specific shape? 

Basically, in the shapesheet, add 2nd geometry section and duplicate entries from initial, geometry1 section.  Now, edit the row for the switch "indicator" show it shows closed contact.  Your drawing should show both open and closed conflicts at this point.

At the top of each geometry section is entry geometry1.no show or geometry2.noshow...or something like that.  In the geometry2.noshow, enter formula =not(Geometry1.noshow).

To control the viewing, you need to add entry in the action section.  That entry would toggle the geometry1.no show entry.  That would then alternate the views.

Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 26, 2017, 12:01:27 PM
I attached the two shapes that I want to combine. And want to be able to press show Pos A or PosB.
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 26, 2017, 01:55:45 PM
I would appreciate help with how to do this in the shape sheet data.
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 26, 2017, 02:25:37 PM
These are two different switches? 

I've not seen these before, but I only have V2007 standard.  Could you upload them?   Another solution in this case, load be to overlay them and group, assign each to each to a layer, then toggle between the two layers.

Not sure what you mean "press".  Visio doesn't have pressure sensitive functionality.  This could be done with a double click or with right click and select desired view.  Each amounts to two mouse clicks.

Wapperdude

PS:  I need VSD file type.  Others can do it with VSDX.
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 26, 2017, 02:44:32 PM
Thanks wapperdude for responding. These two shapes I have created them myself. I brought the example of a switch where you can switch the views of it to an open switch or closed switch by right clicking and selecting show_open circuit and then show_closed circuit. I was wondering if there is a way to do the same thing with these two shapes that I have created. I would like to be able to see Pos A or Pos B of these shapes. I would like to select show_PosA or show_PosB.

I like your layer solution and I dont mind it but I would prefer to be able to switch between the views like a switch does because, I have many different shapes that need this function and toggling between layers will take forever. I hope you understand what I am trying to accomplish here.
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 26, 2017, 03:54:21 PM
First, toggling layers would be fast.  It's reasonably simple:  assign switch1 to a layer, named, SW1 and switch2 to layer oh, SW2.  Group the shapes.  Then, set a single action to toggle layer SW1 on/off.  Set SW2 visibility to be NOT SW1, that way visibility always toggles between these two shapes.

If you want assistance, upload the two shapes.  If they're proprietary, send me message and I'll provide email contact.

Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: vojo on May 28, 2017, 01:45:21 AM
group shape is the circle
subshape1 is the "case A"
subshape2 is the "case B"
2 actions at the group level
   "show case A"
   "show case B"
on each subshape, go to geometry sections....in noshow cell = if (action<x>.checked,false,true)

now when you right click on group shape, select case you want.   (checked means you want to see it)

Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 30, 2017, 11:52:22 AM
Wapperdude you are a big help. If you could, please help on how to toggle and how set the visibility not to be SW1. I attached a file with both of the shapes. Thanks
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 30, 2017, 02:15:27 PM
I'd be happy to look at the shapes, but, you'll need to upload as vsd as I never graduated beyond V2007.

Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 30, 2017, 02:24:17 PM
I attached a VSD file instead.
Title: Re: Help Creating a Custom Shape
Post by: Surrogate on May 30, 2017, 02:44:12 PM
Quote from: skydiver13 on May 30, 2017, 02:24:17 PM
I attached a VSD file instead.
Are you sure ?  ;D
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 30, 2017, 04:31:54 PM
I saved it as vsd. Did I do it wrong?
Title: Re: Help Creating a Custom Shape
Post by: Surrogate on May 30, 2017, 04:33:37 PM
Quote from: skydiver13 on May 30, 2017, 04:31:54 PMDid I do it wrong?
You attach vsdx file again !
Quote from: skydiver13 on May 30, 2017, 02:24:17 PM
I attached a VSD file instead.
check file extension !
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 30, 2017, 05:00:28 PM
My bad. This file is now VSD
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 30, 2017, 07:42:31 PM
Modified shape attached.

Top (group) level:  right click and select desired configuration:  Pos A or Pos B.

Modifications include:
1)  Adding actions to top level shape
2)  Modifying sheet.17 to toggle text.
3)  Modifying sheet.3 to toggle view of geometry1.
4)  Add sheet.45 to group to show alternate contact view. 

This ought to do what you need.

Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on May 31, 2017, 02:48:55 PM
Thank you Wapperdude.  :) :) :) Now, I will use this modification setup for my other shapes. Thanks for explaining.
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on May 31, 2017, 03:44:37 PM
Glad to help.

Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on June 01, 2017, 12:39:30 PM
Wapperdude, I was trying to replicate what you did and I quite don't understand how you modified the sheets to toggle text and view. If you can, could you please go over in more detail thanks.
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on June 01, 2017, 02:55:26 PM
Sure. 

Because this is a grouped shape, to keep things simple for the user, most of the commands are added to the toplevel group shape.  This is where the Actions section is implemented.  So, if you select the group, it's sheet.1, in this case.  In the Actions section, there's three entries, the first being a "Title".  The next two establish the actions.  The Checked cell is Boolean.  Either "1" or "0".  It is this cell that determines what goes on. 

Toggle Views:
Now, if you push into the group shape, either by direct selection, or by navigating using the Drawing Explorer window, select either the "Pos A" contact shape (sheet.45) or the "Pos B" contact (sheet.3).  These shapes will alternate their visibility. 

Consider sheet.45.  Go to the Geometry1 section.  At the top, there is entry Geometry1.NoShow.  The following formula is entered, =IF(Sheet.1!Actions.VwA.Checked,0,1).  This sets the toggling.  It refers back to sheet.1 actions.  If Show Pos A view is selected (checked), then it enters value = "0", and the shape is visible.  If not checked, then, formula enters value ="1", and shape is hidden.

Since the action is to alternate between the two views, then, for Sheet.3, the formula is modified to give opposite values.

For the Text:
Select the text shape, it should be sheet.17.  Open shapesheet.  A little bit extra is needed.  First,  need to create entry for the two text labels.  So, I added the User section, and created an entry into row_1.  (I renamed the row to User.VwName.).  There is the following formula:  =IF(Sheet.1!Actions.VwA.Checked,"Pos A","Pos B").  The formula causes the value to switch between the two text strings indicated.  So, half way there.  Now, to show these values in the the shape, I used the Insert>Field menu item.  (Not sure where it is on the ribbon.)  From the pop-up window, select User-defined Cells category, and then select VwName.  Hit OK.

That's it.  That's the mechanics behind doing the toggling.

HTH.
Wapperdude
Title: Re: Help Creating a Custom Shape
Post by: skydiver13 on June 01, 2017, 05:24:32 PM
Thank you again Wapperdude.  ;D ;D ;DSince you know so much on Visio, where could I learn more about Visio. If there some good book or tutorial that can teach on every subject in Visio?
Title: Re: Help Creating a Custom Shape
Post by: wapperdude on June 02, 2017, 05:04:37 AM
How to learn Visio?  Books are one way. 
You might want to start here:  http://visguy.com/vgforum/index.php?topic=5034.msg19756#msg19756 (http://visguy.com/vgforum/index.php?topic=5034.msg19756#msg19756)
This link points to some additional books:  http://visguy.com/vgforum/index.php?topic=2566.msg11137 (http://visguy.com/vgforum/index.php?topic=2566.msg11137)

But books aren't the only way.  This link, although old, so it doesn't do containers, for example, but what it does do is give you a good foundation/understanding for Visio: 
https://msdn.microsoft.com/en-us/library/aa217846(v=office.10).aspx (https://msdn.microsoft.com/en-us/library/aa217846(v=office.10).aspx)

Also, the free SDK's have many code examples on many topics.  Just google for Visio SDK.

Here's link to video series by the Visio MVPs:  http://www.visguy.com/2012/02/01/roll-em-new-visio-2010-video-series-by-visio-mvps/ (http://www.visguy.com/2012/02/01/roll-em-new-visio-2010-video-series-by-visio-mvps/)

While the search engine isn't the greatest, this forum provides a wealth of information. 

Wapperdude