visualize the shortest path in a chart

Started by kiler40, September 18, 2014, 04:42:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JuneTheSecond

Best Regards,

Junichi Yoda
http://june.minibird.jp/

kiler40

Something like this..

There is trully a lot of place for improvement.
Not in the code (for me) but in visual interpretation. 


But i really like the approach.  :)

Of there are more ideas - please share :) !

Yacine

#17
Hi Andrei,
I unfortunetaly could not run your upload. Why is it a jpln? can you upload a vsd?

I on the other hand could not hold on myself and continued to play.

The main thing to make the solution viable is certainly the ergonomy. Having to select two nodes, then start the macro is too complicated.
Instead, the new nodes have a menu in which you can set whether they are the source or the target node.
This menu changes the custom properties of the page, which then triggers the path routine.

This customisation is written in setup routines. Start first the page setup routine manually.
The pages gets a menu to setup the shapes. So later additions of shapes is possible.

Cheers,
Yacine
Yacine

kiler40

Sorry. You remember when i told you that i use my phone to have i.access.
This must be the file.
I'll check yours when i reach work (where i have visio...)


kiler40

I`m back again :)

Here is the real file.
This is the entire diagram i`m working with.
This code have a little modification :)
it is not drawing only one path. The first shape you select is the start point, and every next you select is recognized as an end point. the algorithm draws after that all the paths.

Now i have a questions:
every shape have an start and end prop.row
How can the code understand what is start and what is end.
every time i try to create a cycle that goes through all shapes and look for that prop.row and adds it to selection - something turns wrong

Any idea for a solution.

Yacine

Good morning Andrei,
The trick is to trigger a macro by changing the value of a cell.
In the enclosed example it is one of the custom properties startshape and endshape of the page.
These cells are changed by selecting one of the options start/end of a shape in the drawing.

I think it is a bad idea to set custom properties, as you would need to reset them.
Rather use action menus as shown in the example.
Yacine

kiler40

Good morning Yachine.
I'll use excel to define start and end of the diagram. One start and several ends.
This is most easy for me with prop.rowS
I know i need reset all properties. But i cannot do.
I was thinking for sth like
Sub add_selection()

Dim val As String

 

For Each shp In ActivePage.Shapes

    If shp.OneD = False Then

     If Not shp.CellExists("prop.start", visSectionProp) Then

        End If

         Else

           If shp.Cells("prop.start").FormulaU = True Then

            visSelect

             Else

             End If

    End If

 

  Next shp

 

End Sub


But it gives an errr

Yacine

I did not really understand your problem.
If you want to reset the shapes, then you should reset all the starts and ends to false, without additional conditions. Isn't it?

    If shp.CellExists("prop.start", visSectionProp) Then
        shp.Cells("prop.start").FormulaU = False
    End If
    If shp.CellExists("prop.end", visSectionProp) Then
        shp.Cells("prop.end").FormulaU = False
    End If
Yacine

kiler40

#23
This is the reseting .
First i want to select the one that have start = true
then to select all shapes that have end = true :)

My problem is selection :)