Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: smr on July 16, 2008, 10:43:31 PM

Title: resolved : shape elevation
Post by: smr on July 16, 2008, 10:43:31 PM
Hello,
I'm drawing a floor electrical network. Now it is finished and I code some VBA routine to generate reports on wires, plugs, switches. I got lengths of wire, but this lengths are the length that the wire use on the floor.

How could I take into account the extra vertical length of wires that go up to plugs or switches on walls?

I tried to set elevations for plugs, but that doesn't change the length of wires.

Thank you for any help

Serge
Title: Re: shape elevation
Post by: philippec on July 17, 2008, 07:02:28 AM
I rolled into Visio in the hope it could do such things.
Maybe you can add wire in an invisible layer.
Or make a function that add the height ?
In that area of Visio, there is nothing but trouble.
Title: Re: shape elevation
Post by: Lars-Erik on July 17, 2008, 08:16:11 AM
You could add a custom property for the wire to manually enter a "extra" length for the height. Then have VBA add that to the already calculated length...

- Lars
Title: Re: shape elevation
Post by: smr on July 17, 2008, 09:54:27 AM
Thanks for this ideas,

The idea to add a custom property is simple because I know how to add programatically a height property only to plugs or switches.

It is not simple to add extra length to wires in their shape data, because I need to add extra length only to wire that are connected to a switch or a plug, and I don't like to parse all wires manually to add this extra length to only ones that are concerned.
To do this by VBA leads to my former post, how to detect to what shape is connected a wire, hopefully, I got an answer to this question.

But I have a simple solution because I add a custom property to shape that register a name of my own. I coded the name of shape so it includes the name of room where they are and for wires, the name of shapes where they are connected to.

So by parsing the shape names given by Visio, I can know if the shape is a wire, a plug or a switch, and when I calculate the wire length, I can know from the wire custom name, to what shape it is connected ; so either I can add extra length if the wire is connected to a plug or switch, or get the custom height property of the connected shapes.

Now, why not to use elevation property instead of a custom property? What is the use of this elevation propoerty?

Thanks

Serge

Title: Re: shape elevation
Post by: Lars-Erik on July 17, 2008, 10:41:26 AM
Not sure what it is used for tbh, never used this template before.
Title: Resolved : shape elevation
Post by: smr on July 18, 2008, 01:55:50 PM
Hello,
Finally I used the default base elevation property, and the infos in my post about getting reference to shapes connected to a wire. The result is :

For Each pag In ThisDocument.Pages

    i = 0
    For Each shp In pag.Shapes
           
            If InStr(1, shp.name, "Wire con") Then
             i = i + 1
             ReDim Preserve myArray(i)
             length = 0
             name = shp.Cells("prop.name").FormulaU

              For j = 1 To shp.Connects.Count
               test = InStr(1, shp.Connects.Item(j).ToSheet, "outlet") + InStr(1, shp.Connects.Item(j).ToSheet, "switch") _
               + InStr(1, shp.Connects.Item(j).ToSheet, "light") + InStr(1, shp.Connects.Item(j).ToSheet, "lum")
             
               If test > 0 Then

                  length = length + Val(shp.Connects.Item(j).ToSheet.Cells("prop.baseelevation").FormulaU)

               End If
             Next
           length = length + Round(shp.LengthIU * 0.0254, 2)   'get the length in metric unit
           myArray(i) = name & ";" & length

        End If
    Next shp
Next pag


thanks for your helps

Serge
Title: Re: resolved : shape elevation
Post by: Visio Guy on July 20, 2008, 09:18:24 AM
Hi Serge,

One comment: I'd specify that I want the name of the ToSheet, like this:

shp.Connects.Item(j).ToSheet.Name

Instead of assuming the default property of a shape will give me the name, as you have:

shp.Connects.Item(j).ToSheet

There are also other name-related properties: NameID, NameU that might be of interest.
Title: Re: resolved : shape elevation
Post by: smr on July 21, 2008, 06:43:51 AM
Hi Visio Guy,

It is good to be perfect, I made the correction.

Thanks.

Serge