# Visio Guy

## Visio Discussions => Programming & Code => Topic started by: Visio Guy on May 19, 2008, 04:54:34 PM

Title: Poll: Dropping Predefined Shape Assemblies
Post by: Visio Guy on May 19, 2008, 04:54:34 PM
Watch this video:

or

I've created a prototype of a mechanism for dropping assemblies of shapes, without having to ungroup (and sever!) a Master. The poll and video are inspired by this thread:
[Tutorial] Auto ungroup shapes on drop (http://visguy.com/vgforum/index.php?topic=26.0)

The idea is to define an "assembly shape" by simply typing in a bunch of text that names masters, and indicates text and other properties that are set when each individual shape is dropped. Here's the sample text from the shape in the video:

[Circle]
Text="Hi, I’m circle #1"
PinX=Width/2
PinY=Height/2
[Circle]
Text="Hi, I’m circle #2"
PinX=3*Width/2
PinY=Height/2
[Circle]
Text="Hi, I’m circle #3"
PinX=5*Width/2
PinY=Height/2
[Square]
Text="Hi, I’m a square!"
PinX=2
PinY=2
Angle=35deg
LineColor=RGB(255,0,0)
FillForegnd=RGB(255,120,120)

Circle and Square are masters in the document. A lot of this can be done with Data Graphics/Link Data to Shapes, but I'm not so sure if the relative positioning can be easily done, or if the need for shape assemblies is always matched with a need for Data Graphics/Link Data to Shapes.

Anyway, I'm interested to hear what you think!

Title: Re: Drop Shape Assemblies Using Shape Text and Code
Post by: Lars-Erik on May 19, 2008, 05:01:20 PM
Who knows, this might come in handy someday...
How does it work exactly? How do you insert the text?

Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: Visio Guy on May 19, 2008, 05:29:38 PM
The text is simply typed on the page. Then some code parses it.

You could write code to generate the text as well, once you've defined a text format. I think XML would probably be a good idea, but I just used a fairly simple [MasterName] then line-by-line Prop=Val format, with a special case for Text.

I thought I'd throw the video up there, just to figure out how to do videos, polls, and to see if people absolutely freak out and go wild over this, or if it is just mildly interesting. Let's wait and see!
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: vojo on May 29, 2008, 01:06:51 PM
nice idea!!!

Since going down this route, would not it be also useful specify any connections between shapes and even setting
custom propertties for a given shape.

aka a "shape assembly line"
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: Visio Guy on May 29, 2008, 02:38:15 PM
The way it is now, custom properties are no problem. Connections would need some work...
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: visProcessEng on July 03, 2008, 07:41:41 PM
I share your passion for avoiding Grouping whenever possible.

I have probably taken the opposite approach in the way I address this issue, by creating multi-geometry shapes.

For example all the circles in your example would share a common master ('multi-geometry').  By making the circles appearance dependant on Shape Data and by including control points for each circle the user can turn off each circle or reloate it on the page.

I include data graphics (headings) to show tag numbers and other shape data.

I have also made the master aware of it's location on the page so the geometries, shift in relationship to each other (to try to stay on the page).  I can send you an example if you like,  The master has some overhead associated with it, but given that I used tens or hundreds of each in a single document (they are Local + Remote Instrument Bubbles with Callouts, Alarm Points Control System) the overhead serves to compress the overall size of the file.

Let me know if you would like to see an example.

P.S.  I am working on a getting a file share account set up so I should be able to post examples more easily.

Steve
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: vojo on July 18, 2008, 10:49:27 AM
what would really make this a killer app is to define a connection or association between the shape being dropped (or dropped already) with another shape on the page.

Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: shayneneal on August 30, 2008, 04:02:08 PM
I have to be honest - I just found this site and have absolutely NO experience with VB.  I have been using Visio for a decade but never even realized what it could do until this week.  Your site is amazing.  The information is a little deep (sometimes much more than 'a little') and sometimes goes so far over my head that I couldn't see it with a telescope.

As for the video,  what could it be used for?  I may actually have a use for it but I can't tell yet.  *sigh*

I did watch another video after this one however (Badly Behaved Visio Shapes (http://www.youtube.com/watch?v=_OOHTT7I_Fo)) and was super excited by what it did and would love to learn how do do it!  I have looked into taking a visio course but the only stuff I can find in my area is childish drawing that I have been doing for many years.  I did order a book in hopes of starting some self-training (http://www.amazon.com/Visio-2003-Bible-Bonnie-Biafore/dp/0764557246/ref=sr_1_7?ie=UTF8&s=books&qid=1220129655&sr=1-7) but it is not going to be a fast process.

Despite low voting, please keep the videos and polls coming.  There are some of us out here who are trying to play catch-up from more than a few laps back and you need to be patient with us.

If anyone has any suggestions on books or courses, either Visio or programming apparently, please feel free to send the suggestions.

Thank you everyone for taking your time to share,

Shayne
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: wapperdude on May 29, 2010, 02:02:15 PM
This reminds me of the "old days" in engineering when you would enter a netlist for circuit simulation by hand.   Brrrr.  Cold chills running up/down the back.

Other than that, it's quite clever.

Wapperdude
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: AndyW on March 10, 2011, 03:06:53 AM
Quite impressive given its off the stencil, more so if it handled connectors. My attempt at that required a page in my diagram that has some shapes (which are groups) and connectors. Putting a selection box around the shapes then grouped them. If they were dragged off the page onto another page, then they were automatically ungrouped. Does have have an advantage that they can have their custom properties etc set and the user can create his own. The big downside is that that are not a stencil so not so convenient to drag and drop and not so easy to share/update as not a stencil. Food for thought though. keep up the good work/ideas.
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: MacGyver on August 28, 2012, 11:33:27 AM
Would it be possible for you to post the source for the macro that parses the text?
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: Michelle on November 28, 2012, 10:34:52 AM
I need this capability *right now*!  LOL.  I just posted a question in the VBA forum on this very topic.  I had found some code to do this, but it wasn't working correctly.... Can you please let me in on the secret??? Pretty please?

Michelle
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: vojo on May 01, 2014, 04:50:56 PM
vote:   Might need it someday

Perhaps I am missing something, but what is the difference between this and a group drop?
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: Visio Guy on August 03, 2014, 06:07:18 AM
With a group drop, you

1. Effectively sever master instances from their masters, so the assembly will get out-of-date if you update the masters
2. A group-drop needs to be ungrouped, which results in an alert message that is scary for novice users.
Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: Noisy Cricket on July 29, 2015, 05:12:51 AM
Ok! I might have use for this, right now.

We've got several projects with a core team and several operational phases which require temporary "extensions" of these project teams. The extensions (sub teams) themselves are in turn pretty much standard. Instead of creating multiple "standard" organization charts, we're thinking of creating these subteams and storing them in stencils to be deployed only when needed.

Now, to no-one's surprise, these assemblies "fall apart" when dropped on the page and lose their ability to "connect" to an existing organization chart. Visio reports that "organization chart shapes cannot be members of a group shape"......

I think this ties into the main subject so the question is: how can "teams" be stored in a stencil and be dropped on a page and keep their individual org chart functionality?

Title: Re: Poll: Dropping Predefined Shape Assemblies
Post by: FFC on August 18, 2016, 03:27:35 PM
With a group drop, you

1. Effectively sever master instances from their masters, so the assembly will get out-of-date if you update the masters
2. A group-drop needs to be ungrouped, which results in an alert message that is scary for novice users.

To avoid point #2, you just need to make a simple Macro who gets called by the eventdrop like:
Code
``Sub degrouper(shpObj As Visio.Shape)    Application.AlertResponse = 1    shpObj.Ungroup    Application.AlertResponse = 0End Sub``