How do I determine the length of a wire

B

Bart Sipes

I am trying to determine the length of a wire connector in Visio. I am using
the wire connector in the Electrial and Telecom shapes group. I would really
appreciate any help here. Thanks
 
V

Visio Padawan

Right Click anywhere and goto view, click on the "size & position" option. It
should open a box that tells you all about the "physical" properties of
whatever object you click on. It is also great for making sure that the
length of objects are exact(beware though, some objects are measured from the
center. I think boxes are, but if you notice something wierd it's either that
or the degrees are opposite of what you thought). Good luck.
 
C

Chris Roth [MVP]

I take it your wire has some bends in it, in which case it gets a bit more
complicated.

If you want to use automation and can do a bit of VB/VBA programming, you
can use the LengthIU property:

visio.ActiveWindow.Selection(1).LengthIU

However this doesn't work if the path is open (due to a BUG). So you have to
temporarily close the path by setting:

Geometry1.NoFill = False

Then get the .LengthIU, then subtract the distance from the begin to the end
of the connector (ref: Pythagorus)


--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 
A

Al Edlund

there was also a bug in the lengthiu code for awhile, so know what version
of visio you're at would be a help.. :-(
al
 
B

Bart Sipes

I am using Visio 2003 (11.3216.5606). I am familar with VBScript but I have
never done anything with VBA. If you know of any good general tutorials on
how to do something like this I would appreciate it (i.e. is this a macro?
and other basic stuff). I'm sure I can figure out the programming I just need
to know where to go first.

Thanks for the advice so far.
 
C

Chris Roth [MVP]

Well, you have VBA built right in. Just hit F11, and you'll probably be able
to start working.

Either in a Sub or in the Immediate window, you'll want to be able to get
'hold of the selected shape. That looks like this:

ActiveWindow.Selection.Item(1)

I just published a very simple article on programmatically creating
flowcharts. It has VBA code inside of a Visio diagram that you can download.
This should give you more than you need to get a sense of how to talk to
Visio via code. It lives here:

http://www.wanderkind.com/visio/2006/09/create-visio-flowcharts.html

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 
B

Bart Sipes

Thanks for the example although it doesn't run. It crashes on line 91 --
Set mstProcess = docFlowStencil.Masters.ItemU(MasterProcessName)
It gives error 91, object variable or With variable not set.

Also, do you happen to know how to acess points along the line so that i
could get a better estimate of the length of the wire. (Basically use Riemann
sums if you are familiar with calculus)


Chris Roth said:
Well, you have VBA built right in. Just hit F11, and you'll probably be able
to start working.

Either in a Sub or in the Immediate window, you'll want to be able to get
'hold of the selected shape. That looks like this:

ActiveWindow.Selection.Item(1)

I just published a very simple article on programmatically creating
flowcharts. It has VBA code inside of a Visio diagram that you can download.
This should give you more than you need to get a sense of how to talk to
Visio via code. It lives here:

http://www.wanderkind.com/visio/2006/09/create-visio-flowcharts.html

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio


Bart Sipes said:
I am using Visio 2003 (11.3216.5606). I am familar with VBScript but I have
never done anything with VBA. If you know of any good general tutorials on
how to do something like this I would appreciate it (i.e. is this a macro?
and other basic stuff). I'm sure I can figure out the programming I just
need
to know where to go first.

Thanks for the advice so far.

Al Edlund said:
there was also a bug in the lengthiu code for awhile, so know what
version
of visio you're at would be a help.. :-(
al

"Chris Roth [MVP]" <visioguy [at] hotmail [dot] com> wrote in message
I take it your wire has some bends in it, in which case it gets a bit
more
complicated.

If you want to use automation and can do a bit of VB/VBA programming,
you
can use the LengthIU property:

visio.ActiveWindow.Selection(1).LengthIU

However this doesn't work if the path is open (due to a BUG). So you
have
to temporarily close the path by setting:

Geometry1.NoFill = False

Then get the .LengthIU, then subtract the distance from the begin to
the
end of the connector (ref: Pythagorus)


--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun
at:
www.wanderkind.com/visio


message
Right Click anywhere and goto view, click on the "size & position"
option. It
should open a box that tells you all about the "physical" properties
of
whatever object you click on. It is also great for making sure that
the
length of objects are exact(beware though, some objects are measured
from
the
center. I think boxes are, but if you notice something wierd it's
either
that
or the degrees are opposite of what you thought). Good luck.

:

I am trying to determine the length of a wire connector in Visio. I
am
using
the wire connector in the Electrial and Telecom shapes group. I would
really
appreciate any help here. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top