## Articulated Line

Started by Hey Ken, June 13, 2018, 09:47:33 PM

0 Members and 1 Guest are viewing this topic.

#### Yacine

#30
... we're almost there  .

Added some gimmiks ... and wishes (wishes, not requests! Thought you would enjoy some challenges ).
Yacine

#### Hey Ken

Messrs. W. and Y:

So while I spent the weekend answering political surveys and filming TV commercials, you guys were having all the fun.  Clearly, there's something out of kilter with my priorities.

The cylinder is virtually perfect!  Exactly what I was looking for, except for one very important feature: it does not cater to my predilection for laziness.  Why should I have to diddle the control point whenever I change the topology of the shape?  Fortunately, it was a short step to correcting it: In the group's control point's Y cell, I substituted the elegant BOUND function for a blunt Height/Width*0.05.  So now it stays the same constant height regardless of what I throw at it (at least for ratios less than 1, but that's far too minor to matter).  Regardless, it solves my problem.  Many thanks!!  Remind me to cut your taxes.

As for that pesky articulated line, it's much closer to where it should be.  Still needs the second arrowhead to be added plus some bounding on both arrows, but otherwise it's where it should be.  I'll dig into all that after November 6th.

Thanks again!

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### wapperdude

Adding double-arrowheads wasn't that difficult.  It took 3 new geometry sections, one for each line segment.  If you select double arrowheads from the GUI, it automatically gives them.  There is a minimum spacing function that prevents the arrowheads from overlapping based upon lineweight and segment length.  There is no adjustment based upon arrowhead size.  If the length gets longer, the spacing will increase, as a percentage of that length.  The arrowheads are spaced symmetrically about the control point.  They are not independently placeable.

Wrt to limiting the range of the arrowhead placements, that bound to be a problem.  It's a four quadrant issue.  More than I care to get into at this point.

At a minimum, you have a starting place for doing the double arrowhead problem.

Then, there's this challenge to forum members...this development was based upon V2007.  Since then, there's new features in the object model, to wit, point along a curve.  So, the challenge is to re-work the approach using more up-to-date approach.

Yep.  There I've said it.

Wapperdude
Visio 2019 Pro

#### Hey Ken

Folks:

Of course when you have a solution in hand, you always try to improve it.  So having a grouped solution, I took it further to attempt an ungrouped solution.  Well, I found one – except for one basic problem: Fill doesn't fill the entire shape.  I did some searching about, but to no avail.  The best I found was an article by John Goldsmith that acknowledged my problem without saying how to correct it.  He said, "By default, the boolean rules governing overlapping geometries means that the rectangle geometry will be given the fill and the three Ellipse geometries will be empty."

How do you change that default?  I tried tricks with Join, Union, etc., but to no avail.  All of them re-introduced the behavior the shape is meant to eliminate.  I also tried replacing the ellipse (whose shape I like) with two elliptical arcs, but it has the same problem (aside from being less pretty).

My latest it attached containing both the grouped and ungrouped shapes.  (You can ignore the untoward behavior of the ungrouped's bottom arc -- I know how to fix that, but there's no point in fixing a secondary problem until you fix the showstopper.)  All I want is to have the color fill the entire ellipsy shape.  Any suggestions?  Besides "Give up!" that is?

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### wapperdude

Here's ungrouped approach.  I left the control point in to convenient set the oval height...orange shape 1st page.  But, the height now remains constant with both width and height changes.
Visio 2019 Pro

#### wapperdude

Well, while I'm at it., another, non-grouped option.  Call this fun with fills.

The controlling cell is the GeometryXXX.NoFil cell.  This cell, as  previously mentioned, has a Boolean personality.  So, where two geometry sections overlap, there lies the Boolean interaction.  The fourth shape is designed such that there is maximal options:
1)  Full shape fill
2)  No shape fill
3)  Only oval shape fill
4)  Only cylinder wall fill

Just play with the true/false, i.e., 1 / 0, settings of the geometry.nofill cells.

Wapperdude
Visio 2019 Pro

#### Hey Ken

0.4886*User.Thk^-1.015??  Of course!  Why didn't I think of that!  It's so obvious!  (NOT!)

Good plan, splitting my ellipse into two elliptical arcs.  Understandable, and your piecing them together kept the illusion of an oval better than I could manage.  It's that highly-intuitive 0.4886*User.Thk^-1.015 that did the trick.

We have a real winner here with your final shape, Wapperdude, what with the constant topologies, color choices and all.  It's all I could ask for, and more!  Thanks!!

Henceforth I shall refer to it as The Wappershape.

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### wapperdude

...or perhaps wapper-thebull-dawg?

As for being intuitively obvious, well, it wasn't.  I knew that cell helped keep things looking elliptical.  But, was there a nice expression to define it.  Trial and error with different settings proved that a linear relationship was unlikely.  From my past life, when I earned money to make a living, I remembered using Excel to do curve fitting and finding trends.  So, taking a proper amount of data points, I then let excel find the necessary equation.  As they say in England...Brilliant!  LOL.

The coloring scheme thing with the NoFill cell was again experience with such a thing.  I have a JuneTheSecond post to help me recognize the interaction with multiple geometry sections.  You, subsequently, found the John Goldsmith article.

To do really clever fill patterns, then you will need to use the grouped approach.

Dawgoneit!
Visio 2019 Pro

#### wapperdude

#38
Here's a new version.  This is based upon feature incorporated with the newer Visio releases (those since V2007).  I always had it in the back of my mind that the pointalongpath and nearestpointonpath could simplify this development.  So, here it is.  Note, as mentioned in a V2019 Issues post, the nearestpointonpath bug forced the use of grouped shapes, consequently, this isn't as clean as I hoped.  But, it is much improved construction-wise.

This is a tri-articulated line, that can be either 1, 2, or 3 segments.  Each segment has it's own control for moving an arrowhead.  The arrowhead reverses direction at the segment mid point.  The arrowhead can be either a single or double.  The spacing of the arrowheads is proportional to the length of the segment.  The Actions menu allows selection of single or double arrowheads, and 1, 2, or 3 line segments.  All in all, this is much better behaved.

Wapperdude
Visio 2019 Pro

#### Hey Ken

Wapperdude:

Your latest result inspired me to dust off the less-than-ideal version I've been using, and I think I have exactly what I need.  Like you, I finally resorted to using grouped shapes, and the final version meets all my requirements.  It's 100% shapesheet and works in any version starting from 2003 (which is what I run at home) limited only by SETATREF support.

I took the single-segment arrowed line I've been using for years, grouped several together, and added some of the techniques from entangled shapes, but instead of keeping the common attributes in TheDoc!User.whatever, I keep them in the group's User section.  That makes it easy for all line segments to share the same attributes, and SETATREF lets you change them from any segment.  It also makes it easier to reach the values via VBA.  It's a three-segment line, but it's fairly easy to open the group and add additional segments as needed.

Check it out; it's attached, and as .vsd version for us Neanderthals.  Suggestions welcome, as ever.

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### Hey Ken

Folks:

I've been using this articulated line for a few years now, and it's worked reasonably well.  But I don't like how the bounding box looks.  So my immediate goal is to have the box tight around the segments.

I'd prefer a DOCMD shapesheet solution to reset the box, but I couldn't locate one.  However, I was able to do it by adding the following code:

`Sub ResetAlignmentBox(TheShape As Shape)TheShape.UpdateAlignmentBoxEnd Sub`

I call the code by putting the following into its own user cell in the group-level shape:

`=CALLTHIS("ThisDocument.ResetAlignmentBox","Tracer")+DEPENDSON(NOW())' "Tracer" is the name of my stencil where the code resides`

Whenever you move the line segments around, it fires and re-sizes the alignment box as expected.  Yes, it does re-size the box once every minute as well, but I can live with that.   Maybe.  Read on...

All that said, this solution is not my preferred solution; it's just a hack that gets me close.  What I really want is for the DEPENDSON to depend on the Width cell in any one of the group's subshapes.  But I can't figure out how to reference the subshape's Width cell from within the grouped shape's shapesheet.  You think it'd be a straightforward Sheet.nn!Width, but that keeps on giving me an error.  What am I doing wrong?

Getting back to the DEPENDSON(NOW()), it likes to fire at odd times, not just once a minute.  One of those odd times is when I save the master shape.  The first time I try to save the shape Visio gives me an error, but the second time it saves it fine.  But then when I save the stencil, Visio does the saving, but it still thinks the stencil is unsaved.  Because the DEPENDSON fires whenever you save it?  Beats me.  All I know is I want the subshape Width reference there, not the NOW().

Always something!

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### wapperdude

Should be doable in shapesheet.  Two options, both in Misc. Section
1) Just hide the box:  set NoAlignBox = True

2) set UpdateAlignBox = True.
Visio 2019 Pro

#### vojo

docmd(1312) to present shape data.
Shape data field to show/hide (could just make it a command for that matter)
use show/hide to trigger shapesheet setting to show or hide specific stuff

#### Hey Ken

Vojo:

Not sure I understand what you're suggesting.  All I want is for the alignment box to show, and to automatically adjust whenever I move the line segments around.  I used your DOCMD in place of NOW(), but it repeatedly asked me if I wanted to define user data.  Not what I was looking for.

Wapper-man:

Not sure I understand you either.  Setting UpdateAlignBox to True did nothing.  I did it in all the segments and the group, with and without NoAlignBox, but the box doesn't cling to the segments.

To reiterate: My goal is to have the alignment box cling tightly to the line segments.  Ideally, I want to change...

`=CALLTHIS("ThisDocument.ResetAlignmentBox","Tracer")+DEPENDSON(NOW())`
...to say...

`=CALLTHIS("ThisDocument.ResetAlignmentBox","Tracer")+DEPENDSON(SubshapeOne!Width)+DEPENDSON(SubshapeTwo!Width)+DEPENDSON(SubshapeThree!Width) `
...but I don't know how to access ""SubshapeOne!Width" from the grouped shape.  Or SubshapeTwo and SubshapeThree, for that matter.

It turns out it doesn't matter, because I DO know how to access the group shape from the subshapes.  So I turned the problem around.  In the grouped shape (Sheet.17 in this example), I added three User section rows, SubshapeOne, SubshapeTwo, and SubshapeThree.  I added a fourth row that says:

`=CALLTHIS("ThisDocument.ResetAlignmentBox","Tracer")+DEPENDSON(User.SubshapeOne)+DEPENDSON(User.SubshapeTwo)+DEPENDSON(User.SubshapeThree)`
Lastly, in the first subshape, I added a User.Cell with =SETF(GetRef(Sheet.17!User.SubshapeOne),Width), then SubshapeTwo and SubshapeThree, respectively.

That did it.  Whenever any of the line segment lengths change, the new width is reflected on the grouped shape's user cell, and that user cell is used to trigger the DEPPENDSON.  Problem solved.

Thanks again for the help!

- Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

#### vojo

given that you think you can swap DOCMD for Now(), I think you got to do a lot more reading before you attempt what
you are attempting.   Not insulting you, but if you think DOCMD does something similar to Now(), then some further research on Visio capabilities so that you can use all the tools in the toolbox.