Visio Discussions > ShapeSheet & Smart Shapes

SetAtRef et al.

<< < (3/5) > >>

wapperdude:
OK, so, my curiousity got the better of me...

Suppose that both shapes had a shapedata entry, Prop.bend.  Now, you want to use Prop.bend to control the rounding in both shapes, plus use the UI for rounding, and of course, not clobber the formulas.  Perfect scenario for SETATREF...mostly.

The temptation would be to do the following for each shape.  Shape1 shapesheet, rounding cell:  =(SETATREF(Prop.bend) + SETATREF(sheet.2!Prop.bend))*0.5.  The 0.5 factor is needed since the two results are additive.  Unfortunately, this only sort of works...the rounding of both shapes responds as expected, but, the Prop.bend cell in sheet.2 doesn't update.  Even if you don't do the 0.5 factor. 

Still wanting to keep this simple, and since SETATREF intercepts the direct changes (which is why the formulas don't get clobbered), the formula can be modified to =SETATREF(Prop.bend)+SETF(GETREF(sheet.2!Prop.bend),Prop.bend).  The SETATREF intercepts the direct change, recalcs the Prop.bend, and updates the Rounding cell.  The SETF fcn gets the Prop.bend cell in sheet.2 and updates it with the value of sheet.1's Prop.bend.  This has the added benefit that the results of the two functions are not additive...pun intended.   ::)

Of course, sheet.2's shapesheet needs similar entries, only, pointing to sheet.1.

Finally, the DblClick event has DOCMD(1312) to directly access the shapedata.

Attached is Visio file of all of the above to help visualize.  Each shape displays its own Prop.Bend and Rounding so you can see the changes in values as they happen.

Enjoy,
Wapperdude

JuneTheSecond:
I am using SetAtRef to change color of invisible faces of my intelligent cube.

spandex:

--- Quote from: wapperdude on March 14, 2015, 11:17:19 AM ---OK, so, my curiousity got the better of me...

Suppose that both shapes had a shapedata entry, Prop.bend.  Now, you want to use Prop.bend to control the rounding in both shapes, plus use the UI for rounding, and of course, not clobber the formulas.  Perfect scenario for SETATREF...mostly.

The temptation would be to do the following for each shape.  Shape1 shapesheet, rounding cell:  =(SETATREF(Prop.bend) + SETATREF(sheet.2!Prop.bend))*0.5.  The 0.5 factor is needed since the two results are additive.  Unfortunately, this only sort of works...the rounding of both shapes responds as expected, but, the Prop.bend cell in sheet.2 doesn't update.  Even if you don't do the 0.5 factor. 

Still wanting to keep this simple, and since SETATREF intercepts the direct changes (which is why the formulas don't get clobbered), the formula can be modified to =SETATREF(Prop.bend)+SETF(GETREF(sheet.2!Prop.bend),Prop.bend).  The SETATREF intercepts the direct change, recalcs the Prop.bend, and updates the Rounding cell.  The SETF fcn gets the Prop.bend cell in sheet.2 and updates it with the value of sheet.1's Prop.bend.  This has the added benefit that the results of the two functions are not additive...pun intended.   ::)

Of course, sheet.2's shapesheet needs similar entries, only, pointing to sheet.1.

Finally, the DblClick event has DOCMD(1312) to directly access the shapedata.

Attached is Visio file of all of the above to help visualize.  Each shape displays its own Prop.Bend and Rounding so you can see the changes in values as they happen.

Enjoy,
Wapperdude

--- End quote ---

Wow, Wapperdude, I'm speechless. I really appreciate your help!

Going through your shapesheets, I have a question: when either of your shapes changes line rounding via the Shape Data dialog (dbl-click), what mechanism causes the Rounding field in the same shape to update?

Thanks so much!

spandex:
Thanks to everyone's help, I believe that I have what I need:

* The rounding for a given shape can be set by either a Shape Data RMB dialog or a standard Visio dialog (such as Line | Format)
* The two input methods track each other, so a change in one will cause a change in the other
* Rounding can be turned off via an item in the RMB pop-up menu, and this causes rounding to use zero
* If rounding is turned back on, the last non-zero value is remembered and used
A copy of the Visio doc is attached. Also attached is a PDF that shows the primary cell changes that are needed to implement this.

Thanks, again, for everyone's help

spandex:
Long explanation about my ultimate goal follows:

BACKGROUND
This rounding issue is part of an effort to update a stencil I  have been using and tweaking for 15+ years (IIRC, before Microsoft purchased Visio). Two shapes that were distributed with Visio (Visio Technical?) really interested me. One was a circle with a connection point in the center and several connection points around the circumference. They had no special code. The second was a connector whose begin and end points would glue to the centers of two circles. In addition, a control near each end would be glued to a circumference of a circle. The connector would then be drawn between the circumferences of the two circles; the line and arrow(s) would not go inside it. Another control, which I call the AlterCurve control, allowed the user to raise or lower the height of the center of the curve. When AlterCurve was moved or one of the circles was moved, the ends of the connector would move themselves around the circumferences so that the lines/arrows would always point to the centers of the circles.

I modified the connector shape to add two primary features:


* Add support for a rectangular shape
* Allow the AlterCurve control to move in both the X and Y directions, which I referred to as Skew and Height, respectively.
The curve was implemented using SplineStart and SplineKnot geometry rows. Over the years, I have added various rectangular shapes, including folder shapes, a database (or "store") shape, and a UML Actor shape.

CHALLENGE
I now need to support a general ellipse, but I needed more information on the Spline rows. Unfortunately,  these row type have been deprecated. I then considered NURBS, but that seemed like extraordinary overkill. I decided to use two straight lines and to utilize rounding to make it "curvy." That's where the rounding requirement comes from. The connector must be completely redone to remove the Spline vestiges.

I have almost everything working, but I need to do a lot of testing.

Question: would this stencil be of interest to anyone? If so, I could attach it to a subsequent post once I have it ready.

Thanks!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version