Author Topic: Articulated Line  (Read 127 times)

0 Members and 1 Guest are viewing this topic.

Hey Ken

  • Full Member
  • ***
  • Posts: 152
  • Just This Guy
    • Ken Krawchuk, Libertarian for Pennsylvania Governor
Articulated Line
« on: June 13, 2018, 04:47:33 PM »
Folks:

    Attached is a rough draft of a new shape I’m working on, an articulated line, and I need some help.

    The way It works is that you can add or remove additional line segments, with the location of each vertex managed by moving a control point.  That was fairly easy to accomplish, but the place it got difficult is where I added moveable arrowheads to the first line segment.  My question is: How can I add a similar pair of moveable arrowheads to the second and third line segments?   I’ve wasted far too much time trying to get the beast to work, but to no avail.  Any suggestions? 

    Thanks in advance,

    - Ken


Ken V. Krawchuk
Libertarian for Pennsylvania Governor
KenK4Pa.com

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3152
  • Ideas Visio-lized into solutions
Re: Articulated Line
« Reply #1 on: June 14, 2018, 12:06:22 AM »
Oh, I see.  I thought you were talking about a highly educated, proper line.  Just kidding.

Not sure this will do what you want, but here's a variation.  The arrowheads remain at the end of each segment.  I only did two segments.  Note, geometry1 defines the beginning and end points, and all segments would fit within these limits.  Geometry1 is not visible.  Best I could come up with at this late hour.

Cheers.
Wapperdude
Visio 2007 Std

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3152
  • Ideas Visio-lized into solutions
Re: Articulated Line
« Reply #2 on: June 14, 2018, 12:19:33 AM »
Doh!.  Never mind.  You  can control the appearance of the arrowheads by turning the fill on or off.  So, the construct for the other line segments just needs to be similar to the first.  You end up with one section that has full length line with no arrowheads, and then a 2nd line with arrowheads that overlays the first.  Gives the illusion of moving arrowheads.  That was my quick and dirty after looking at what you did.

Here's updated file to give you the idea.  If you have newer version of Visio, I think it's not too difficult to make the arrowhead control points stay on the lines.  Otherwise, I'll leave the math and gory details to you.

Anyway, HTH
Wapperdude
« Last Edit: June 14, 2018, 12:43:09 AM by wapperdude »
Visio 2007 Std

Hey Ken

  • Full Member
  • ***
  • Posts: 152
  • Just This Guy
    • Ken Krawchuk, Libertarian for Pennsylvania Governor
Re: Articulated Line
« Reply #3 on: June 14, 2018, 08:19:12 AM »
Mr. Dude:

    Thanks for taking the time to play around with the inarticulate articulated line. 

Quote

I think it's not too difficult to make the arrowhead control points stay on the lines.


   LOL!  That is precisely the issue I’ve been grappling with!

    Some brief background: I’ve been using the simple, single-segment version of that line for years, adjusting the arrowheads as artistically necessary.  There are times where I need to connect multiple single-segment lines into one longer, articulated line—I’ve found they are much better behaved than Visio’s native self-routing lines—but connecting multiple lines has its own foibles (accidentally disconnecting, losing right angles, issues with innie/outtie connection points, etc.), so laziness dictated that I try to build a better-behaved, multi-segment version of my classic single-segment arrowed line.  Which brings us to the issue at hand.

    As I mentioned, supporting multiple segments is no big deal; the issue is keeping those pesky arrowheads on top of their line on the additional segments.  Obviously it has to begin with a row in the Controls section so that you can move the arrowheads to suit, but how do you limit things to keeping their endpoints on the host line segment?  I tried several approaches, but it seems a true solution would be contradictory.  You can’t GUARD the X and Y on the Controls; that defeats the purpose of the control.  Nor can you use GUARD on the GEOMETRY section because the control points will still be free to go where they may.  BOUND was handy to keep the arrowheads from exceeding the X-endpoints of the host line segment, but it’s constraining the control point itself that’s stumping me. 

    Having the arrowheads constrained to the line is important to me, because if it does not behave itself automatically, then I have to go in there and manually align things.  That’s a cure worse than the disease.

    One option I expected to hear was to use a group, but that has even more problems.  You can hide the group-ness easily enough, but if you move the wrong line segment, the connection is broken.  GUARDing the connection does not stop that if you move the unGUARDed side.

    So I’m stumped.  And I do not want a VBA solution.  That’d be cheating.  ;- )

    - Ken


Ken V. Krawchuk
Libertarian for Pennsylvania Governor
KenK4Pa.com

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3152
  • Ideas Visio-lized into solutions
Re: Articulated Line
« Reply #4 on: June 14, 2018, 08:59:59 AM »
Briefly thought about grouping, and just as quickly dismissed it.  My initial reaction says this can be done in shapesheet alone.  Seems like it's close.

I forgot which version of Visio you have.  With newer versions, I think that point along a curve, or whatever it's called, would do the necessary positional constraints.  Then, add the bound fcn to keep each narrowband within the limits of its line segment.

Alas, I only have V2007, so cannot pursue that thinking any further.  If you're still old school like me, then I'll have a go at the formulas.  I may actually have that solved...need to rummage about a bit.

Visio 2007 Std

vojo

  • Hero Member
  • *****
  • Posts: 1104
Re: Articulated Line
« Reply #5 on: June 14, 2018, 09:25:20 AM »
2 cents to consider

1)  you can use loctoloc to lock the arrow the end of the line.  something like
     guard(loctoloc(pnt(<line x coord>,<line y coord>),<line ref point - width or similar>,<arrow ref point - idth or similar>)
     no groups needed

2) as in June's stuff, his primary and shadow lines track to a control point of the group.  Where ever you move the
    control, June's math makes the appropriate bends to make sure the line end point (or begin point) line up with the control
    points

no VBA involved with either...use shape data to assist in usage

Some examples attached

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3152
  • Ideas Visio-lized into solutions
Re: Articulated Line
« Reply #6 on: June 14, 2018, 03:48:40 PM »
Well, several dead cats later, and just having sooooo much fun, here is an imperfect solution, old school style.

1) Major break-thru was to use the SETATREF family fcns.  This "slaved" the arrowhead points to the section control points.
2) The first section from width*0 was easy.  The second section, in this case, only two sections, had to handle issues with the section control exceeding the total width.  Not an issue if it is less than the zero, as that seems to work favorably.
3) Main issue has to do with the exact, 90 deg cases.  These are special cases as they result in divide by 0 scenarios.  Obviously, not good.
4) Did not add bound function.   This gets really messy as the limits change when either section control is less than 0 width or greater than 1 width.

Well, here's a step.  This is a lot of work to be lazy.  I kinda like the idea of just a single segment, and gluing segments together as needed.  Yeah, they can pull apart, but, at this point, there's no weird cases to handle.

Wapperdude
Visio 2007 Std

Hey Ken

  • Full Member
  • ***
  • Posts: 152
  • Just This Guy
    • Ken Krawchuk, Libertarian for Pennsylvania Governor
Re: Articulated Line
« Reply #7 on: June 18, 2018, 07:50:50 AM »

Wapperdude:

   I feel your pain.  But between the two of us looking for a solution, the cats never stood a chance.  ;- )

   Never considered the SETATREF functions—and I mean never.  Didn’t even know what they did!  But that’s one of the reasons I hang out here; ya learn new stuff all the time, and here’s yet another opportunity.

   Seeing how there are still a few cats out there, let me take your fine example and expand it to three or four segments that can be turned on or off at will.  Thanks for showing it’s possible.

   - Ken

Ken V. Krawchuk
Libertarian for Pennsylvania Governor
KenK4Pa.com

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3152
  • Ideas Visio-lized into solutions
Re: Articulated Line
« Reply #8 on: June 18, 2018, 09:21:57 AM »
I made an attempt to do an in-depth, but understandable exploration of the SETATREF fcns:  http://visguy.com/vgforum/index.php?topic=6383.msg26308#msg26308

Wapperdude
Visio 2007 Std