Shape to Shape Message Pipe

Started by vojo, April 22, 2008, 07:47:59 PM

Previous topic - Next topic

0 Members and 16 Guests are viewing this topic.

vojo

The ability for 2 shapes (not in a common group) to exchange data (user cells or custom prop cells) without invoking VBA or special code.

Can almost do it today except cant convert the string representing the msg catch cell in the other shape into a form that SETF can use.

Even if just converting a string into a format compliant for functions would be fine (without using code).

vojo

May not be such a big deal anymore.   I figured out how to make a communication pipe (e.g. ability for shapes to pass custom props to back and forth directly) between 2 unrelated shapes (separate, not in same group, dropped at different times, etc) using NO code at all or templates...just shape shapesheet cells and functions.  Comm can go both ways between the shapes.  Going poke at a bus implementation but dont think its going to be that hard now that I cracked the nut!!!!

Lars-Erik

Might be nice to tell us HOW you did it, in addition that you did it :)

vojo

in essence, you have 3 shapes.
Shape 1 = "ViSIO_DNS"
shape 2 = source shape  (can be both)
shape 3 = sink shape (can be both)

place visio_dns down first
place source and sink in any order at any time

next step can be done a bunch of ways, but I used actions
On the source/sink shapes, have an action to register the shape with the visio_dns shape
On the visio_dns shape, have an action to make the connectors:   Tell sink where source is and tell source where sink is by placing shape name in specific cells.
Each shape builds up structures to identify the specific cell of interest....ie conceivably, I guess you could have 2 shapes sharing 100 channels if you wanted.

So here is the secret:

The placement of a msg from source into sink is the following:

IF(Actions.setsrce.Checked=1,SETF(""&GetVal(User.sink_name)&"",User.srce_outbnd_msg),FALSE)

User.sink_name = User.sink_shape&"!user.sink_inbnd_msg"

Right now, I just use action.checked to say when link is hot...can easily add an index incase other shapes take over name...verify sender/receiver.

The outbound msg can be any text string...aka could have key custom properties or even build up a "command, data" msg ...something like "cmd=0001, data=0002"
obviously the more complex it gets...the more of interest it is to do in code.

The value I see is if a shape needs to acquire some graphic property (color) or some key custom propertiy defining affinity from another totally independent shape
(ie shapes are not in the group, therefore not via some cool designer, manually set the shape cells as appropriate when he created group...aka not doing copy/paste in development mode)



shayneneal

#4
I am a newbie when it comes to anything other than drawing a shape... when I started reading about your problem it sounded intriguing but when I tried to replicate what you were talking about to better understand what you meant (because I barely realized it was english), I found myself stumped trying to find a Visio DNS shape. 

I am seriously challenged here.  I had no idea how stupid I was.

Shayne

vojo

the shape that has the register action is the one that stitches things up (DNS) (dark gray if I recall)
The light shapes can be source or sink depending on actions selected.

This is not for the faint of heart...very subtle usage of text string functions. 

So I am playing around with using a a background page as the pipe for the two shapes to communicate thru.
This will stay away from all the subtle text processing to build the formulas.

Stay tuned

visiofox

Hello vojo,

is it possible to get an example drawing (Visio 2003 prefered) from you? Just use PM.


Thanks in advance and greetings
Udo

vojo

gold pages are the best so far.....to test on 3 way....type something on source outbound msg and
see it appear on the sink inbound msg cell.

To set up
   1. drop mapper (dark box)
   2. drop source/sink (lite grey box)
   3. select source
   4. drop source/sink (lite grey box
   5. select sink

play with it...from there you can decide if you want to build on it.

Have fun.

Now all that said....I am starting think a  background page will shapes cells as a fabric is a better way to go.   This can get a whole lot easier except visio does not do cell update deterministically....that is the key problem here...hence the semaphore problem.   One way around this, I believe, is to have the entire msg in a cell (source name, sink name, msg) where source would clear out msg cell in transport when it got an answer back from sink acking receipt.   Obviously, there are alot of livelock/deadlock issues with a broadcast approach.

anyway...have fun

visiofox

Dear vojo,

thanks for your answer, but...

> anyway...have fun

,,,I can't because I don't understand what you are doing. I really,
really need an example drawing! Or step-by-step instructions.


Thanks so far
visiofox


vojo

five steps cited already

All this does is the dark box uses string functions to route source msg to sink device.   Dont worry about that....just get a blank sheet and do the 5 steps.    Then in the source shape (light grey), type in a text string in the source msg cell.   Then check out the sink shape inbnd message and see your message show up.

This is pretty tedious and probably not for any mainstream activities.  You are better off using a background page for this or develope a macro to do the stitching.   Visio has alot of quirks so you should get real familar with the engine before you embark on something along these lines.

shayneneal

Quote from: vojo on September 14, 2008, 01:48:51 AM
To set up
   1. drop mapper (dark box)
   2. drop source/sink (lite grey box)
   3. select source
   4. drop source/sink (lite grey box
   5. select sink

play with it...from there you can decide if you want to build on it.

Vojo, I don't require a response, but I spend 20 minutes searching for a way to figure out what on earth you were talking about.  I found no mapper to drop anywhere, and the sinks that i found all required a counter or bathroom to place them into.   :(

I know that this stuff is probably child's play but 15 years ago you must have been as naive about Visio as I am now (maybe 20 years ago).

Shayne


vojo

Ok...

1. goto the page called gold 3 way
2. right click srce
     - See its checked....so that means it is registering itself as the srce to the mapper
3. right click sink
     - See its checked....so that means it is registering itself as the sink to the mapper

Ok....so here is what happens
1.  Drop the mapper (labeled mapper on gold 3 way page)
2.  right click mapper and hit register
     This makes the mapper register itself on user cells on the page
      (now its fair to say "gee, I need to add user cells to page?  what is up with that")
       so you can do it manually or save as a template or use the gold 2 way to see for no registering)
3. Drop the srce/sink shape (in a stencil it can be either...I did not check that but just disable both)
4. right click srce/sink...select srce
     This tells the srce shape to pick up the mapper pointer from the page
5. repeat for sink shape
     drop...select sink...this tells the sink shape to pick up the pointer from the page.
6. now here is the secret sauce
    All three shapes use alot of text functions and the getref("shape name!cell") construct to build
       a setf(getref(sink), srce_msg) function. 
    Note that the index in there is a rand number to ensure the right srce and sink are talking

As I have said all along, this is not for the faint of heart.   So here is a couple of things to make life easier.
   1. if you made a connector the mapper (add/update the cells) such that that connector only deals
      with one source and one sink, this gets alot easier (no rand number).   What you would do is:
          A.  drop your 3 shapes (srce, sink, mapper)
          B.  connect up visually as you like
          C.  register the connector mapper
          D.  select srce and sink
      now you have a comm channel between the source shape and sink shape without any VBA.  Since the
      update is triggered only by the sink/srce/register actions...there is no dependency on the page cells
      further.
    2. If you make a backgroup page in a template the fabric....you could add a shape and give it say 20
        srce cells (20 groups of srce name and srce msg) and say 30 sink cells (30 name and msg)....as well
        a way to register to it....it could be your fabric for a number of connections.

Now all that said, lets talk about what this could be used for (I think you will see its probably more trouble than its worth).   Lets say you had some custom proprieties you wanted to pass between shapes.   You would have to add the cells to talk those properties (in an orderly fashion) and pass them to the srce msg cells....the sink shape would need to get these properties and one by one respond to the srce cell he got them.   This is pretty complex (frankly way more complex than the animation template I did).   And what if
the properties where numbers vs text ...more complexities.

So as I said, this is not for the faint of heart.

I will spend some time thinking of a better way to do this.....frankly it takes alot of subtleties to do...so to make it easy to use is going to take some creativitiy here.