Masking shape - how to make a control follow another one, but keep it movable?

Started by Yacine, March 16, 2014, 02:54:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Hi guys,
I want to make a masking shape, that features a rectangular hole in a bigger rectangle. The hole shall be movable by means of a control point and it's size shall be adaptable by a second control.
That second control shall follow the first control when it is moved, but stay independently moveable by itself.
I tried some setatrefexpr, but it does not behave as expected, as it takes the absolute value of it's last position.
How can I write the formula, so it considers it's distance from the first control instead?

Controls.Row_2=Controls.Row_1+SETATREFEXPR(10mm)
Controls.Row_2.Y=Controls.Row_1.Y+SETATREFEXPR(10mm)
Yacine

vojo

wouldnt you define a second geometry section, and set the various X,Y to the control points and set to no fill?

I think that is what would happen if you took the 2 shapes, fragmented them, deleted the inner shape, then unioned what is left.

shape to shape relations NOT in group would need alot of loctoloc kinds of things I think.

wapperdude

Right idea, but, with setatref function, unfortunately, if it's not right, well, it's not right without a clue!!!

Change your formulas for the 2nd control point as follows:
Controls.row_2:  =SETATREF(User.Row_1,SETATREFEVAL(SETATREFEXPR(85 mm)-Controls.Row_1))+Controls.Row_1
Controls.row_2.y: =SETATREF(User.Row_2,SETATREFEVAL(SETATREFEXPR(55 mm)-Controls.Row_1.Y))+Controls.Row_1.Y

The trick seems to be to add a dummy cell.  I added the User-defined cell section, with two lines.  1st row is for horizontal movement, 2nd is for vertical.  The values in the setatrefexpr change as the 2nd control point is moved to change the size of the mask opening.

This worked for me.

BTW, I've never updated my "Magic Window" which is similar to your approach, plus allows circular windows, changes aspect ratio to get rectangles and ovals, and also the window transparency.  If interested, I'll upload.  Otherwise, you should be good with the above changes.

Wapperdude

Wapperdude
Visio 2019 Pro

vojo

I guess you could change 85mm X 55mm to props to define the size of the region.

I think the above moves the region around but I dont think it lets you grow or shrink it.

wapperdude

It does both.  The 2nd control, which changes the opening size, uses the setatref functionality and captures the control's position placing the values into the formula.  Those values are updated as the control is moved.  That's the whole point of the setatref.  So, yes, it looks like you're hard-coding numbers into the function, but, in reality, you're not...think of those numbers as a "starting" point.  Since the formula also references the 1st control point, the 2nd control "tracks" with it.

HTH
Wapperdude

Visio 2019 Pro

Yacine

Many Thanks WD,
it was clear that there should be a SETATREFEVAL, but that dummy cell is just brilliant. I wouldn't have found it by myself.

That problem solved, I set up a mask for up to 5 windows, which can be turned visible by means of a custom field.
I tried also to add connection points to the windows, so that callouts can stick to them, but that's quite tedious. So I stopped after the first window.

A routine could simplify the creation of the windows, by letting the user chose the shape, any additional border and so on. It would also eliminate the limitation in numbers of windows.

It would also make sense to have the mask as subshape, so that additional frames could be layed over the windows for highlighting. (The controls would stay in the container shape).

That same shape can then be combined with the snapshot shape, that I uploaded here: http://visguy.com/vgforum/index.php?topic=4773.msg18732#msg18732

So mille grazie again,
Yacine.
Yacine

wapperdude

Oh!  That's neat.  Will add that to my collection.  Great for highlighting text as your example shows.

Wapperdude
Visio 2019 Pro

Yacine

It's actually intended to comment functions in P&IDs. It is used in combination with a database that stores the so highlighted regions of the drawing, with some explanations.
Yacine