Group Shape Master Formulas Not Evaluating When Dropped

Started by efowler, August 23, 2022, 03:55:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

efowler

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

#1
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?

Croc

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

Quote from: Croc on August 23, 2022, 06:23:22 AM
Similar issues have already been discussed in the forum
Croc mean Russian Visio Forum.
Quote from: Croc on August 23, 2022, 06:23:22 AM
You can also read this article with examples -
Please read this article via Google Translate Service
Quote from: Croc on August 23, 2022, 06:23:22 AMPersonally, I prefer translating formulas into local ones using EventDrop.
100%

efowler

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

#5
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.)

Visio 2019 Pro

wapperdude

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

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

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

Quote from: efowler on August 24, 2022, 03:00:17 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

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

Quoteit 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.
QuoteI'm not sure how eventdrop would help me here
I agree. In this case, EventDrop will not help.

Surrogate

Quote from: Croc on August 24, 2022, 08:30:06 AMThis 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

#13
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.
Visio 2019 Pro

Croc

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.