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

Shape within a shape

Started by Nlevesque, March 13, 2024, 07:49:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nlevesque

Hello guys. I have a problem that's probably solvable but due to my complete incapacity to do any coding, I'm stuck.

Bascially, what I want to do is:

- I import a shape from a stencil on a shape already present in a visio page.
- Since I want the former shape to be invisible, it's probably on an invisible layer, or alternatively, it's transparency could be set to 100%.

I want the shape I imported to be able to display information based on the invisible shape within which it's situated. I searched on and off for days and I already know there are no shapeshett function that can help me and that it will have to be done in VBA. I think I norrowed it down to the Page.Shapesearch function but I'm not sure.

But like I said, I know nothing of coding, syntax, etc.

Questions are:

1. Is it possible
2. If so how and
3. would somebody be nice enough to take my by the hand and bring me to the promised world?

Thomas Winkel

Can you provide a Visio document that illustrates your idea in detail?

wapperdude

You definitely need to provide more info.  The Visio doc would be most helpful, but we need more of your thoughts.
1) Why are you dropping a shape over existing shape?
2) Will the old shape ever be used again.
3) Will new shape get moved.  Does old shape go with it?
4) What kind of info?  Text?  Shapedata?
5) Are there connections involved?

My initial process thoughts are:
  A) drop shape over target shape
  B) perhaps fire code upon drop, or keep cover shape selected and run some code
  C) code could use spacial neighborhood to see who is under it...used to get identity of target shape
  D) search target shape for desired info and transfer to cover shape
  E) delete target shape.

As we understand your thought process, the nature of the code will take shape.
Visio 2019 Pro

Nlevesque

The goal is to do a prewiring plan. When I do a prewiring plan I basically have prewiring shapes, as seen in the second screenshot, that I drag onto the plan to show the technicians where the wires have to go. Now since where talking tens and even sometime undreds of cable in a single project, those have to be identified. So when I drag the shape onto the plan I have to manually populate the COMPID shape data and what I enter will appear onto the shape instead on COMPID. (still in the second screen shot) so the technicians knows what to write on the cable. As you can imagine this takes a lot of time so I want to automate part of it. The parts I can automate are as follows:

The first data in the COMPID is the floor. I can populate that easily with ThePage property in the shape sheet. The second data in the COMPID is the room. Now it get's more complicated. What I intend to do is to create a number oh shapes (1st screenshot) called LIVING ROOM, BEDROOM 1, BEDROOM 2, KITCHEN, etc and assign them based on that. LIV, BED1, BED2, KIT for exemple and that value would become the second data in my COMPID. So when I have a floorplan on a page, I will populate the different section on the plan with the corresponding room shape. And when I start dragging the cables shape on the plan, it would populate that 2nd shape data based on the room shape within which it's situated.

I hope I've explained it clearly.

wapperdude

#4
Do you have the various pieces of data for each prewiring shape stored somewhere?  A database or an Excel file for instance? 

In your example there's CAT6 indicated.  Had to be specified someplace. Cable ID???  Where it routes to???  Surely you're not making this info up on the fly?
Visio 2019 Pro

Nlevesque

Quote from: wapperdude on March 14, 2024, 08:48:46 PM
Do you have the various pieces of data for each prewiring shape stored somewhere?  A database or an Excel file for instance? 

In your example there's CAT6 indicated.  Had to be specified someplace. Cable ID???  Where it routes to???  Surely you're not making this info up on the fly?

Basically I have a different shape for every type of cables I use on a project. 23 shapes overall. I put 5 of them in the screen shot below. So the CAT6 you're referring to is not dynamic. It's part of the shape. The COMPID, which I'm actually making up on the fly is the part I want to automate. Right now that COMPID is a shape data in which I write the info I want each time I import a shape on the plan. The info is formatted like this     FLOOR-ROOM-USE-SEQUENTIAL NUMBER. So for exemple a CAT6 cable connected to a TV in the master bedroom on the 1st floor would look like this FL2-MBED-TV-01.

The first data will be in the shape sheet of the page. Something like User.Floor|FL2 that the prewiring shape will be able to get once on the page with the formula User.Floor|ThePage(User.Floor). the 3rd and 4th data will come from drop down menu's. I want the 2nd data to come from the shape below the prewiring shape. So it could be something like User.Room|MBED in the room shapesheet but I need a way for the prewiring shape to be able to get that information just from being dragged above it.
   

Thomas Winkel

#6
See attached document. Is it that what you want?

This is only possible with code.
I used SpatialNeighbors as wapperdude suggested.
See the EventXFMod in ShapeSheet of the small shape.
This triggers the code on move.
I set formulas to the room-shape. So changes are applied immediately.

In your project you should store the code in the stencil, not in the documents.
That's easier to maintain.

Nlevesque

Quote from: Thomas Winkel on March 15, 2024, 03:06:32 PM
See attached document. Is it that what you want?

This is only possible with code.
I used SpatialNeighbors as wapperdude suggested.
See the EventXFMod in ShapeSheet of the small shape.
This triggers the code on move.
I set formulas to the room-shape. So changes are applied immediately.

In your project you should store the code in the stencil, not in the documents.
That's easier to maintain.

Thanks Mr. Winkel. I see that it works. Which means you saved me twice in a row. Thanks a whole lot!!!!!!

Thomas Winkel

Glad that I could help. But please call me Thomas 8)

Nlevesque

Quote from: Nlevesque on March 16, 2024, 06:03:13 PM
Quote from: Thomas Winkel on March 15, 2024, 03:06:32 PM
See attached document. Is it that what you want?

This is only possible with code.
I used SpatialNeighbors as wapperdude suggested.
See the EventXFMod in ShapeSheet of the small shape.
This triggers the code on move.
I set formulas to the room-shape. So changes are applied immediately.

In your project you should store the code in the stencil, not in the documents.
That's easier to maintain.

Hi. I can't seem to make it work. I imported your room shape into a new stencil for me to duplicate it into all the rooms I need. It seems that every time I change the text on the shape (From BEDROOM2 to DINING ROOM for exemple) The text field with the PICTUREFIELD(0) function in it disappear, and when It try to write it back, Visio crashes and restart. Which mean i'm blocked again.

What would be the solution to that?


Thomas Winkel

Sorry, I missed this post. If the problem persists, provide an example that I can reproduce.

wapperdude

Thomas Winkel's recent reply stirred some thought.  With regards to OP possible thoughts, this topic may be closed, but it doesn't seem to be fully resolved.  Review of this post, offered up another option.  That is, each page represents a floor.  On each floor, there may be many rooms.  Each room will have a variety of shapes, and each of those shapes must identify to which room it belongs.  If might be possible to leverage CONTAINERs and Container properties to accommodate this identification.  There may still need be some additional coding, but this may be a useful stepping stone as it were. 

For example, if the SPACE shapes are used to define the rooms, their shapesheet may be edited to make it behave as a container.  This creates ownership and some useful properties.
Visio 2019 Pro

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: 335 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1188KB.
Tokens: post-login.
Cache hits: 13: 0.00194s for 26,722 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]