resolved : shape elevation

Started by smr, July 16, 2008, 10:43:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

smr

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

philippec

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.

Lars-Erik

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

smr

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


Lars-Erik

Not sure what it is used for tbh, never used this template before.

smr

#5
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

Visio Guy

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.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

smr

Hi Visio Guy,

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

Thanks.

Serge