Author Topic: resolved : shape elevation  (Read 5716 times)

0 Members and 1 Guest are viewing this topic.

smr

  • Newbie
  • *
  • Posts: 8
resolved : shape elevation
« on: July 16, 2008, 05: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
« Last Edit: July 18, 2008, 08:58:08 AM by smr »

philippec

  • Jr. Member
  • **
  • Posts: 18
Re: shape elevation
« Reply #1 on: July 17, 2008, 02: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.

Lars-Erik

  • Sr. Member
  • ****
  • Posts: 278
Re: shape elevation
« Reply #2 on: July 17, 2008, 03: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

smr

  • Newbie
  • *
  • Posts: 8
Re: shape elevation
« Reply #3 on: July 17, 2008, 04: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


Lars-Erik

  • Sr. Member
  • ****
  • Posts: 278
Re: shape elevation
« Reply #4 on: July 17, 2008, 05:41:26 AM »
Not sure what it is used for tbh, never used this template before.

smr

  • Newbie
  • *
  • Posts: 8
Resolved : shape elevation
« Reply #5 on: July 18, 2008, 08:55:50 AM »
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 :

Code
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
« Last Edit: July 18, 2008, 11:16:07 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: resolved : shape elevation
« Reply #6 on: July 20, 2008, 04: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.
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

  • Newbie
  • *
  • Posts: 8
Re: resolved : shape elevation
« Reply #7 on: July 21, 2008, 01:43:51 AM »
Hi Visio Guy,

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

Thanks.

Serge