Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: Tegglet on October 06, 2013, 09:33:32 AM

Title: Creating a Floating Line Whose Length is Fixed
Post by: Tegglet on October 06, 2013, 09:33:32 AM
I want to measure the four sides of an area (room or office) and either of the diagonals then in Visio create five lines corresponding to the measured lengths and fix their length.

Providing the length of the lines can be fixed they can be moved and rotated so their ends connect to form an accurate shape representing the measured area.  Easy to do on paper with a pencil and compass but not in Visio.

Any help would be appreciated.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 06, 2013, 06:41:09 PM
The process is very similar to your "line" problem....

After you draw all of your lines, from the menu bar click on Shape.  From the pop-up menu, mouse over Operations.  New pop-up window click on "join".

Now, with the unified shape still selected, right click and select protection from the pop-up window.  Select width, height, and aspect ratio.  Click OK.

Wapperdude

Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: Tegglet on October 06, 2013, 10:37:53 PM
Thanks for your prompt response.

Unfortunately I forgot to mention that I am using Visio Pro 2013.  Microsoft, in their infinite wisdom, have replaced the menus with that infernal ribbon to which I have given an ashtray on a motorbike award.

I have found an "Operations" command and added it to my quick access toolbar but it does not do anything.  I think I am missing a "Developer" tab which I will investigate further in the morning.

Regarding the rest of your instructions, I need to lock or fix the line length and verify that it has not been changed rather than the width, height and aspect ratio of the overall shape.  I find that all to often Visio has done its own thing and changed something that I do not want changed.

It is beginning to look as if this relatively simple task is beyond the capability of Visio, maybe I should go back to pencil, paper and compass. :(
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: JuneTheSecond on October 07, 2013, 06:26:38 AM
I agree with you.
It is one of the most hard task.
I also tried to make a tool like a compass or divider that can trace on the free curve by many steps.
But failed.
Then I made a constant radius circle with a given line in my geometry tools.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: vojo on October 07, 2013, 12:47:18 PM
Assuming 1D shape, then

BeginX = xxmm
BeginY = yymm
EndX = guard (beginx + props.lengthx)
Endy = guard(beginy + props.lengthy)

Props.lengthx = dx mm
Props.lengthy = dy mm

Eventdblclk = docmd(1312)

Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: JuneTheSecond on October 07, 2013, 04:24:16 PM
Your code is nice.
But this fix not only the length but also angle.
I think we need angle is free.
It is very hard to realize.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: vojo on October 07, 2013, 07:14:45 PM
I thinking locking the endx and endy would fix the angle.
In essence, its sort of like  the end is a fixed offset from the beginning regardess of beginning point

last resort, could have a angle = guard (props.angle)
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: vojo on October 08, 2013, 02:18:06 AM
The other way you could do this is with a control point

Have a free floating control point

Beginx is free floating
Beginy is free floating

Props.length = zz mm

Scratch.a1 = (ang360(atan2(control.x, controly)/1 deg)* 1 deg      // * 1 deg is real important

Endx = guard(beginx + props.length*cos(scratch.a1))
Endy = guard(beginy + props.length*sin(scratch.a1))

Angle = atan2(scratch.a1)....or.... guard(endy-beginy, endx-beginx)

This how the pie shape works.

Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 08, 2013, 07:29:31 AM
Looks like Vojo beat me to the punch. 

Basically, took the same approach using control points.  I remembered an angle measuring shape, so I modified it.  (There's probably clean up that could be done, but this is kinda quick and dirty.)  There are 3 control points: 
  1.)  Controls the angle
  2.)  Controls the length
  3.)  Positions the text which shows the current length and width.

Double click allows you to set precision, change angular degrees, and enter the length.

Could use more work to hide the text.

See attached.

Wapperdude
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: JuneTheSecond on October 08, 2013, 01:57:36 PM
Thank you all.
Your solutions are very good.
But would not satisfy Tegglet.
Please image compass or divider that you would have lerned how to use in junior school.
The Visio control point to guide the direction of the constant length of line should be just on top of this line.
It is very hard task to realize in Visio.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 08, 2013, 05:11:31 PM
Actually this does meet the requirements.

The length control point is a "slider" sets the length of the line.  This length is preserved thru all rotations.  The control point does not move with the line.

The angle control point is used to rotate the line.  It is independent of the length.

Draw a circle, centered on the beginning of the line, with radius equal line length.  Push the circle back to view the line.  It should extend from circle center to outer circumference.  Rotate the line.  This will verify that line length is constant.

HTH
Wapperdude
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: vojo on October 08, 2013, 05:59:40 PM
this solves the problem....its how the pie shape works.

In essence, the pie shape radius is constant....the control point defines orientation...and thus how much of the circle is filled in by the pie.
to make the pie larger (increase radius) you use other methods.

All I suggested adding was to allow, via props, to define length

I have done similar, though not exactly the desired behavior here, on may drawings
(alot these shapes I did were based off your iso stuff....real nice work!!!!)

Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 08, 2013, 10:12:17 PM
I've updated the shape: 
  1. cleaned out some stuff that wasn't needed
  2. added ability to specify desired angle via double click menu
      It's a little clunky.  Tried unsuccessfully to use setatref functionality.  So, came up with a 2 step process.  Step1:  enter desired angle.  Step 2:  use right click menu and hit the update angle entry.  It works, but, sure would be nice to have a cleaner approach. 

  3.  right click menu allows you to hide the text.

Wapperdude

Ooops.  Found a bug.  Attachment removed.

The file is back.  The original Visio file seems to have same problem, at least on my PC, Win7, V2007.  For thick lines, they tend to disappear when the angle is >90 & < 270.  Thin lines are fine.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 09, 2013, 02:55:37 AM
Solved the line width problem.  One extra line in the geometry section.

Here's updated file.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: Tegglet on October 10, 2013, 09:09:35 AM
Sorry for the tardy response, I have not been well for the past few days.

Just had a play with wapperdude's solution and it appears to deliver the goods.  I will measure up the area this weekend and try it for real.  I will let you know the result on Monday.

Many thanks to those who contributed, especially JuneTheSecond who latched on to the essence of the problem straight away.  I must admit I did not think the topic would arouse so much activity.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: Paul Herber on October 10, 2013, 09:13:48 AM
I think it's amazing what gets achieved on this forum, so much enthusiasm for Visio. The official Microsoft forums are a total waste of space in comparison.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: Visio Guy on October 10, 2013, 02:38:34 PM
So JuneTheSecond was on track for the ultimate solution, but the shape jumps around a bit because of ShapeSheet limitations. Visio would need some sort of constraint solver to do this right.

Then Wapperdude got the right idea of decoupling the 1D endpoint handles from the actual geometry.

I've taken Wapperdude's tack to some extent, but with my shape, you use the regular 1D handles to control the angle, and a control handle or shape data to set the line length. So, both the angle and the length can be set either visually or numerically.

To summarize, you can control the attached shape like this:

Angle: Size & Position Dialog, or 1D endpoint handles
Length: Size & Position Dialog, Shape data field or 1D endpoint handles

There one connection point at the end of the line segment, so the beginning of other lines can be glued to it.

You can right-click or use the shape data field to show/hide the length and angle text.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: vojo on October 10, 2013, 03:13:23 PM
what....no love for my appends on this....I guess I dont get roses anymore  ;-)

Seriously...no problem guys....glad it all worked out
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: wapperdude on October 10, 2013, 03:29:13 PM
Vojo:  Carnations OK?  Actually, your initial response was what encouraged me to work harder on this.

VisioGuy:  Nice finish.  Solution is very clean.
Title: Re: Creating a Floating Line Whose Length is Fixed
Post by: JuneTheSecond on October 12, 2013, 06:07:12 AM
For All.

I am very sorry to insist too much about my opinion,
though you have posted many good solutions.

But I am still thinking is there any other alternatives.

Here is an example that can make chain of lines of constant lenght, 
or trace free curve with constant length lines.

It uses Dependson function and SetF function in the shapesheet.
    Prop.Length = 10 mm
    Use.Row_1 = DEPENDSON(Angle,Width)
                            +SETF(GetRef(EndX),BeginX+Prop.Length*COS(Angle))
                            +SETF(GetRef(EndY),BeginY+Prop.Length*SIN(Angle))
Of course, it has some defects as listed on attached drawing.