Author Topic: Group text subshape moves position if master connector is horizontal/vertical  (Read 56 times)

0 Members and 1 Guest are viewing this topic.

efowler

  • Newbie
  • *
  • Posts: 1
This is my first time dealing with connector groups/subshapes and I'm running into an issue I can't figure out.

I'm wanting to make a double label connector. I've found some online, but I want to make one exactly the way I want it, kind of particular about it. So I created a straight dynamic connector and converted it to a group, then added a rectangle subshape to the group, and adjusted the size to the width/height of the text inside the rectangle. I then position the rectangle at X=0,Y=0, which apparently is relative to the master shape so it should be at the start point of the connector. This works well when the line is at an angle, however when I make the line vertical or horizonal, the rectangle offsets itself from the connector while still showing coordinates X=0,Y=0. See the attached pictures to see what I mean.

Thanks for any help!

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4374
  • Ideas Visio-lized into solutions
Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2953
If you watch the formulas of the connector when being inclined, horizontal or vertical, you'll notice that the formulas for width and height change.
Inclined and horizontal:
  width = GUARD(EndX-BeginX)
  height = GUARD(5 mm)

Vertical:
  width = GUARD(5 mm)
  height = GUARD(EndX-BeginX)


Odd enough, it has probably something to do with the way Visio calculates the length.
I also don't know where the 5mm come from. It seems to be neither the grid spacing nor the size of the sub-shape.

Anyway, how to find the right point for the different inclinations of the connector?
I helped myself with a control point, set it to (0,0) and (1,1) and observed that it jumps like the sub-shape does.
So I corrected manually the position of the control point to get the coordinates for the rectangle.

Ending up for the sub-shape with the formulas
  PinX = IF(Sheet.1!BeginX=Sheet.1!EndX,Sheet.1!Width*0.5,Sheet.1!Width*1)
  PinY = IF(Sheet.1!BeginY=Sheet.1!EndY,Sheet.1!Height*0.5,Sheet.1!Height*1)
  for the end point
respectively
  PinX = IF(Sheet.1!BeginX=Sheet.1!EndX,Sheet.1!Width*0.5,0)
  PinY = IF(Sheet.1!BeginY=Sheet.1!EndY,Sheet.1!Height*0.5,0)
  for the begin point

----

Later I checked the links Wapperdude provided, specially the one from John Goldsmith.
He uses an intermediate field with a POINTALONGPATH formula. Certainly a more elegant way, since you can place the label "on" the connector at "any" place.

« Last Edit: Today at 02:17:04 AM by Yacine »
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4374
  • Ideas Visio-lized into solutions
LOL.  I actually excluded the pointalongpath and control point from my thought process.  But, the two can be combined, along with anglealongpath, if desired, to move the label to any desired location.  Here's supplemental reference:  http://visguy.com/vgforum/index.php?topic=8695.msg37997#msg37997
Visio 2019 Pro