News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Container - can you have non rectangular containers?

Started by miless2111s, September 29, 2024, 04:08:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

miless2111s

Containers are interesting shapes but they always seem to be rectangular.  Is it possible for them to closely follow the contained shapes - rather like shrink-wrapped packaging clings to what it contains.
I have tried to show what I mean here:
https://ibb.co/Ytnyvzk

The top container is the normal rectangular one, the bottom left is the shrink-wrapped one and then the other has nice curved corners :)


Thomas Winkel

#1
You can convert any shape to a container by adding the user field:
msvStructureType = "Container"

Also have a look at the other user fields of a standard container.

miless2111s

Interesting, thank you.  The ability to make other shapes containers in interesting but they don't seem to be as good at avoiding clashing the shape outline with the contained shapes.

They obviously also don't do the shrink-wrap thing I am trying to work out :)  But very interesting information so thank you :)


wapperdude

Frankly, I don't believe shrink wrap is possible. I believe containers and lists function on a simple bounding area principle governed by both the max length and height occupied by its members.  While the physical shape of the container may be altered, it is the bounding rectangle that governs its size.  This is the result noticed by the OP in reply #2.

I can think of only one Visio shape that will contort its size to match a pre-existing irregularly drawn shape.  That is the area calculating shape, who's name  don't recall.
Visio 2019 Pro

Nikolay

#5
Yes, you are absolutely right, shrink-wrap is not possible, sorry for the confusion (hounds like ChatGPT, sorry)  :-[

I was confused by automatic resize,
just recalled that one can see some sort of auto-size in "database diagram" template shapes.

Yacine

Yes, but no.
It certainly depends on how weird the new shape is. And it ought to be feasible to define a star, a cloud or something similar with a bounding area that excludes the extra geometry.

@miles, what kind of shape where you thinking of?
Yacine

Thomas Winkel

The shape of the container can be as required. But its bounding box will always be a rectangle:
You cannot view this attachment.

I used the line tool to draw the shape.
Then "Format Shape -> Line -> Rounding size" to round of the edges.
And then User.msvStructureType = "Container" to create the conatiner.
Of course, this can also be automated. But there is no Visio function to create such a shrink-wrap shape.
That's the challenging part.

Visio Guy

If the irregular geometry is more important that using Visio's built-in container features, and you are willing to do coding, check out these API items:

SpatialRelation
SpatialNeighbors

You can detect if a shape is within/touching/engulfs another shape using Visio's automation functions.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

wapperdude

#9
Those functions would definitely be helpful.  But this coding task is not for the inexperienced nor the faint of heart.

After the spatial fcns identify the container, its shape must be changed.  This could require adding rows, changing row types, some calculations.  As container shape is modified, perhaps invoking Shape.DistanceFrom, Path.Points methods, to correctly trace the outline of the new shape.  In addition the container outline may have to be modified to shrink around existing shapes.   Working with nonlinear shapes may exacerbate the tracing process.  Finally, it may be desireable to apply this to pre-existing container shapes.
Visio 2019 Pro

miless2111s

Quote from: Yacine on September 30, 2024, 09:23:19 PMYes, but no.
It certainly depends on how weird the new shape is. And it ought to be feasible to define a star, a cloud or something similar with a bounding area that excludes the extra geometry.

@miles, what kind of shape where you thinking of?
The shape needs to be entirely flexible as the container could hold 3 shapes or 15 and these could be arranged in any configuration which will be changed as time goes on.

miless2111s

Quote from: wapperdude on October 02, 2024, 02:23:38 PMThose functions would definitely be helpful.  But this coding task is not for the inexperienced nor the faint of heart.

After the spatial fcns identify the container, its shape must be changed.  This could require adding rows, changing row types, some calculations.  As container shape is modified, perhaps invoking Shape.DistanceFrom, Path.Points methods, to correctly trace the outline of the new shape.  In addition the container outline may have to be modified to shrink around existing shapes.   Working with nonlinear shapes may exacerbate the tracing process.  Finally, it may be desireable to apply this to pre-existing container shapes.

I fear I may fall into the inexperienced bracket :)  So it is possible that rather than a specific shape it could be more of an initial shape that forms a collection of shapes around which a new shape is drawn or the original shape which is then modified for location and shape using the sam criteria (colour, rounding, line thickness etc) as it originally was given?

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 379 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1255KB.
Tokens: post-login.
Cache hits: 13: 0.00190s for 26,724 bytes (show)
Cache misses: 3: (show)
Queries used: 18.

[Show Queries]