S***@gmail.com

2007-04-11 17:32:46 UTC

Hi all,

I'm trying to limit the length of a line to be a multiple of a certain

value (for example, it can be 3 in., 6 in., 9 in., etc.) and I'm

having some trouble figuring out how to do this.

Note that this isn't the same as having the grid set to 3 in, because

I want the line length to be a multiple of 3 in. no matter what angle

it's at.

It would be great to be able to do this through the Shapesheet, but it

wouldn't be a problem to do this through code (we already have Visio

add-in code running for our application).

What I've tried so far:

1) using the BOUND function in the Shapesheet.

This was hurting my brain for multiple reasons. First, the length of

a line (the "Width" cell) is a calculated cell, not a pure value, so I

didn't know how to incorporate the BOUND function. In addition, I

didn't know how to limit the values using the BOUND function.

Normally I would use something like: IF(MODULUS(Width, 3) == 0)...

2) Trapping the BeginX/EndX/BeginY/EndY cell changed event

I think this is my best bet so far. The idea being that when the

BeginX/EndX/BeginY/EndY cell changes, set the appropriate cells to

make the length work out to be the nearest multiple of the given

value. So if the BeginX changes, set the BeginX and BeginY so that

the line length is a multiple of 3. One unfortunate side-effect is

that apparently the Cell Changed event isn't fired while dragging (in

2003), so the user would have to drag the endpoint, drop it, and then

the length would snap to the correct length. Would be nice to snap

while dragging...

Does anybody have any suggestions?

Thanks for your help,

Kevin

============================================

***@transystems.com or ***@gmail.com

============================================

I'm trying to limit the length of a line to be a multiple of a certain

value (for example, it can be 3 in., 6 in., 9 in., etc.) and I'm

having some trouble figuring out how to do this.

Note that this isn't the same as having the grid set to 3 in, because

I want the line length to be a multiple of 3 in. no matter what angle

it's at.

It would be great to be able to do this through the Shapesheet, but it

wouldn't be a problem to do this through code (we already have Visio

add-in code running for our application).

What I've tried so far:

1) using the BOUND function in the Shapesheet.

This was hurting my brain for multiple reasons. First, the length of

a line (the "Width" cell) is a calculated cell, not a pure value, so I

didn't know how to incorporate the BOUND function. In addition, I

didn't know how to limit the values using the BOUND function.

Normally I would use something like: IF(MODULUS(Width, 3) == 0)...

2) Trapping the BeginX/EndX/BeginY/EndY cell changed event

I think this is my best bet so far. The idea being that when the

BeginX/EndX/BeginY/EndY cell changes, set the appropriate cells to

make the length work out to be the nearest multiple of the given

value. So if the BeginX changes, set the BeginX and BeginY so that

the line length is a multiple of 3. One unfortunate side-effect is

that apparently the Cell Changed event isn't fired while dragging (in

2003), so the user would have to drag the endpoint, drop it, and then

the length would snap to the correct length. Would be nice to snap

while dragging...

Does anybody have any suggestions?

Thanks for your help,

Kevin

============================================

***@transystems.com or ***@gmail.com

============================================