Electrical Floor Plan - Total Connected Load On a Wire?

Started by Stel, October 12, 2008, 09:36:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Stel

Hi, I'm new to Visio and was wondering if something like this was possible (in Visio 2007 Pro). If I were to create a shape for recessed lights, for example, and enter shape data for their wattage, could I somehow have Visio automatically get a wattage total for all the lights connected to a switch with the 'wire connector' and display that on the floor plan near the switch (or elsewhere)? I have programming experience in C++, php, some assembly, etc. but none in Visio or VB.

Also would it be possible to automatically get a total of lights, receptacles, etc on a floor plan and display the total of each on the page?

Any help is appreciated, thanks.

Visio Guy

Hi Stel,

With code, you can do what you need to do.

I have written a few articles on connecting shapes together. The articles contain downloads, with VBA code. I would generally expect C++ guys/gals to be smarter than us VBA guys (grins, winks), so figuring out VBA shouldn't be too hard.

Connect All Shapes to Each Other
Create Visio Flowcharts Programmatically

Once you're comfortable with a bit of Visio automation we can move to the next step. You actually need to do the reverse of what these articles do: determine what is connected to what. I'll just give you a few pointers on how to do this:

1. Get a light-shape
2. Ask Visio for the FromConnects collection for that shape
3. Each FromConnect object (a Connection object) will have a FromSheet and a ToSheet object.
4. The FromSheet represents the connector. The ToSheet is the very light shape that we started with.
5. Analyze the FromSheets to get the total input wattage
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

aledlund

an easy way to get counts of components is to just drag the legend shape onto the page and use it's capabilities to do the counts for you.
al

Stel

Quote from: Visio Guy on October 13, 2008, 01:00:43 PM
1. Get a light-shape
2. Ask Visio for the FromConnects collection for that shape
3. Each FromConnect object (a Connection object) will have a FromSheet and a ToSheet object.
4. The FromSheet represents the connector. The ToSheet is the very light shape that we started with.
5. Analyze the FromSheets to get the total input wattage

Thanks for the help!

I am able to get a list of FromConnects, etc and see what everything is connected to with VBA (by outputting a text list of all shapes), but I've noticed the custom shapes I've made, RLight 6 and RLight 4, do not have Connection Points listed on the ShapeSheet and VBA also does not show any connections for these shapes even though they appear to be connected on the page. The custom shapes were made by copying the Recessed Light master included with Visio to the Favorites stencil and then customized there with 'Edit Master', and then dropped onto the page. Though if I go into the ShapeSheet for a custom light shape already placed and then add a Connection Points section a new blue connection point appears. If I connect to that point, it works. I guess I didn't create the master correctly?

Visio Guy

My assumption is that you have wires (ie "1D shapes" that are like connectors) connected to the lights.

When you get the FromConnects for a light, each object's FromSheet is the ID of that connector/wire. You can then get information from that wire shape. Say it has a Shape Data field like "Power", you could do something like this:

Dim shpLight as Visio.Shape
Dim shpWire as Visio.Shape

Set shpLight = ....
Set shpWire = shpLight.FromConnects.Item(1).FromSheet

Debug.Print shpLight.Cells("Prop.Power").ResultStr(visNoCast)

Would give you something like:

"10 Watts"
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010