edit a group with code depending on shape data

Started by TwoBeAss, February 07, 2024, 07:43:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TwoBeAss

Hello Visio community,
I want to programmatically change the way a group of shapes (from a master shape) are displayed depending on the shape data. What would be the best way to achieve this?
More in detail:
I want to have a mastershape that holds the information of its connectors with variables like InGroupA, InGroupB, InGroupC, OutGroupA, OutGroupB, OutGroupC and I want to show the amount of shapes for the connectors to be shown depending on the dataset inside the mastershape.
I have tried to visualise my task in the attached screenshots.

What would be the best way to make this work? I would prefer a way using C# inside a VSTO plugin, but I really don't know where to start...

Surrogate


TwoBeAss

What kind of Information should i provide in addition? I was hoping that the screenshots explain the expected behaviour enough ;)

Surrogate

#3
Quote from: TwoBeAss on February 07, 2024, 09:34:26 AM
What kind of Information should i provide in addition?
1. How many connectors can contain group: 0-3 or more?
2. Connectors B1/C1 must have same vertical position for InGroup and OutGroup?
3. You want create a group programmatically on the fly or use pre-made master-shape from stencil?

About 15 years ago I create same solution without code... Only ShapeSheet, only hardcore!!!  ;D

Nikolay

#4
Could you describe the shape usage scenario from a "user" point of view?
I.e. what the user is supposed to be doing with that shape.

Is he supposed to set the number in the "container" (group) shape, and the content then is supposed to reflect that visualy (i.e. the shape "redraws" itself to show those A, B, C sections according to the numbers the user has entered.

OR:

The user drops these typed "brick" shapes (A, B, C) into of the group. When dropped, these shapes align themselves properly inside of the group shape, and the numbers on the group shape are updated to show the number of boxes inside.

Or maybe something else?

wapperdude

#5
I believe the OP is asking for a way to do the following:
1) there is a grouped shape that contains both incoming and outgoing connectors
2) both of these maybe identified as belonging to sub-collections, e.g., A, B, C, etc.
3) he wants to be able to limit which category of connectors are visible based upon defining shape data:  presumably, said data determines the member collection, and whether it is an incoming or outgoing connector.

Seems there are  several possibilities:
1) code that has interface that allows user (the op) to select (a) the collection identity, and (b) connection type
2) code could then toggle visibility of connector and its text based upon interface selections.
3) unclear if viewing options should include all, as in everything, or all members of a collection, or only a very limited case.
3a) unclear what to do with quantity

4) might use layers to set visibility.  This opens possibility of non-code solution.  That is, a master shape as interface to toggle layer visibilty rather than checking connectors individually.  Or possibly using properties assigned to the page itself?

5) in the case where multiple collections viewed, how is each collection distinguished?  Color?  Line styling?  Connector text?  Does it matter?

There is some code that might help here:  http://visguy.com/vgforum/index.php?topic=10240.msg47743#msg47743. It finds members for specific datagraphic.

See this topic for discussion of non-code solution for shape count:  http://visguy.com/vgforum/index.php?topic=7659.msg45677#msg45677. Specfically, layers, Legend Shape.

Visio 2019 Pro

Yacine

This task screams for shapesheet functions. Doing it by external code looks more difficult.

So, must it be C# or can you accept working with a smartshape, dropped from a stencil?
Yacine

Yacine

Yacine

TwoBeAss

I love this board!!
Thanks @Yacine, this is exactly what i needed!!

Thanks to all the other great answers, i really appreciate you support!