Author Topic: Group Shape Master Formulas Not Evaluating When Dropped  (Read 907 times)

0 Members and 1 Guest are viewing this topic.

efowler

  • Newbie
  • *
  • Posts: 6
Group Shape Master Formulas Not Evaluating When Dropped
« on: August 22, 2022, 10:55:47 PM »
Basically what the title says. I created a group shape, made it a stencil, but when I add it to a document, the formulas are not evaluating. I have to go in and click in the formula and press enter, then it turns blue and evaluates.

Surrogate

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #1 on: August 23, 2022, 12:18:13 AM »
Can you share more details?

1. These formulas stored in parent shape or in sub-shape ?
2. Are these formulas referred to other shapes, pages or document cells?
« Last Edit: August 23, 2022, 12:20:20 AM by Surrogate »

Croc

  • Sr. Member
  • ****
  • Posts: 330
    • Visioport
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #2 on: August 23, 2022, 01:23:22 AM »
Similar issues have already been discussed in the forum. You can also read this article with examples - https://visioport.ru/blog/index.php/34-thedocref. The article made the following conclusions:
1. When developing stencils, you should be very careful when using inheritance chains (several consecutive referrens in formulas), they may not work.
2. For long chains, it is desirable to provide for the translation of inherited formulas into local ones. This can be built into shape construction, for example using SETF in the EventDrop event, or using programmatic methods.
Personally, I prefer translating formulas into local ones using EventDrop.

Surrogate

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #3 on: August 23, 2022, 01:54:39 AM »
Similar issues have already been discussed in the forum
Croc mean Russian Visio Forum.
You can also read this article with examples -
Please read this article via Google Translate Service
Personally, I prefer translating formulas into local ones using EventDrop.
100%

efowler

  • Newbie
  • *
  • Posts: 6
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #4 on: August 23, 2022, 05:54:03 PM »
It's a subshape which references the master for its position. It has the following PinX and PinY formulas:

PinX =POINTALONGPATH(Sheet.4!Geometry1.Path,User.Label_A_Distance/SQRT((Sheet.4!EndX-Sheet.4!BeginX)^2+(Sheet.4!EndY-Sheet.4!BeginY)^2))
PinY =POINTALONGPATH(Sheet.4!Geometry1.Path,User.Label_A_Distance/SQRT((Sheet.4!EndX-Sheet.4!BeginX)^2+(Sheet.4!EndY-Sheet.4!BeginY)^2))

When I move the whole shape group to a stencil, those formulas turn black and the subshape does not move when the master connector moves. I'm not sure how eventdrop would help me here, maybe I'm just not understanding.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #5 on: August 23, 2022, 06:34:33 PM »
How did you create the stencil master?

Typically, I create it on nor drawing page.  Once I'm done, I duplicate the shape.  Make sure all the various features work.  Then I drag and drop the shape onto the stencil.  To ally, I drag this stencil shape back onto the drawing page.  All formulas should work.

Edit Note:  Have verified this, using your formulas.  Works fine.  Behaves as desired.  The text box always remains at the beginning of the connecctor. (assuming the User value is set to 0.)

« Last Edit: August 23, 2022, 09:14:18 PM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #6 on: August 23, 2022, 08:20:23 PM »
M$ directions:  https://support.microsoft.com/en-us/office/draw-a-shape-in-visio-259ed0da-4444-4bf3-9093-33a0a79629e8

To create a new master shape
You can reuse your custom shape in other drawings by making it a master shape. To turn a custom shape into a master shape, do the following...
1.  In the Shapes pane, click More Shapes, and then select a custom stencil or create a new custom stencil by selecting New Stencil (US units) or New Stencil (Metric).
2.  On the drawing page, select your custom shape and drag it into the new stencil in the Shapes pane.
3.  To rename your new master shape, right-click the shape, select Rename Master, and then type a name for the new master shape.
4.  In the Shapes pane, on the custom stencil, click Save to save the changes to the custom stencil with the new master shape.
Visio 2019 Pro

efowler

  • Newbie
  • *
  • Posts: 6
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #7 on: August 23, 2022, 10:00:17 PM »
I created converted a connector to a group, added 2 text boxes to the group, and did all the formulas. I can copy the shape and everything works perfectly. The labels stay with the connector, all is good. If I drag a copy into the stencil, and then edit the stencil master, it also works perfectly. But as soon as I drop that master into the drawing again and move the connector endpoints, the PinX and PinY values become #REF! and the labels no longer move with the connector.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #8 on: August 24, 2022, 12:52:41 AM »
Seemed to work fine for me.  I only did one end, will try oth, but don't expect any problems.  Please up load a sample, perhaps there's something that's being missed either in our communication or the steps being taken.
Visio 2019 Pro

Surrogate

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #9 on: August 24, 2022, 01:21:12 AM »
But as soon as I drop that master into the drawing again and move the connector endpoints, the PinX and PinY values become #REF! and the labels no longer move with the connector.
Please check is section or segment exist

Surrogate

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #10 on: August 24, 2022, 02:32:32 AM »
I experimented a bit with the POINTALONGPATH function, it seems to work only with the shape itself in the cell it is used in. The Sheet.4!Geometry1.Path as argument of this function does not work !

Croc

  • Sr. Member
  • ****
  • Posts: 330
    • Visioport
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #11 on: August 24, 2022, 03:30:06 AM »
Quote
it seems to work only with the shape itself in the cell it is used in. The Sheet.4!Geometry1.Path as argument of this function does not work !
This is not entirely accurate, since in its original form such a reference works. It breaks only in the transition Drawing - Master - Drawing
But the way to fix the problem is right!
If you calculate PNTX(POINTALONGPATH(...)), PNTY(POINTALONGPATH(...)) in the User section of the group, and refer to these cells in PinX, PinY cells of a text blocks, then everything works.
Quote
I'm not sure how eventdrop would help me here
I agree. In this case, EventDrop will not help.
« Last Edit: August 24, 2022, 03:35:23 AM by Croc »

Surrogate

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #12 on: August 24, 2022, 04:08:29 AM »
This is not entirely accurate
It seems I had a syntax error at the time. I had the value #VALUE in the formula in the master shape even before I threw the master on the page

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4479
  • Ideas Visio-lized into solutions
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #13 on: August 24, 2022, 07:58:51 AM »
Did follow-up which had label at both ends.  Works fine.  V2019 Pro.   The formulas are placed in the PinX and PinY cells as initially provided with the cadet that my initial master ID was different.   Dragging and dropping onto stencil, and then dragging master and dropping onto page created no ref issues. 

The only issue I see is a needed parent to local scaling issue.  The values translate incorrectly, but that would be expected.  For the beginning point this is not an issue sInce 0 = 0.  But the end point is impacted. 

Croc's suggestion of doing the valve in two User cells might be better form, but seems unnecessary. 

If you manually move the labels after dropping, that will clobber any formula in the PinX and ping cells.  In that case, use the Guard() fcn to protect the formulae.  But that will prevent Manual placement.  If such an option is desired, then the SETATREF() fcn are needed as they intercept & use the manual placement, updating rather than clobbering the formulas.  In addition, I would add control points to allow easy placement.  You had an earlier post that I provided a link which does all of this...I think.
« Last Edit: August 24, 2022, 08:13:43 AM by wapperdude »
Visio 2019 Pro

Croc

  • Sr. Member
  • ****
  • Posts: 330
    • Visioport
Re: Group Shape Master Formulas Not Evaluating When Dropped
« Reply #14 on: August 24, 2022, 08:41:02 AM »
I can offer my version for research.
The PointAlongPathIssue.vsdx file contains two masters.
issue contains the PointAlongPath function in label B. After dropping on the drawing page, label B no longer tracks the position of the end of the connector.
corrected contains the PointAlongPath function in the group. This master is working fine.
This is not a complete solution, but only a demonstration of how the function works in different group shapes.