Shape Connection Info

Started by jimibray, September 08, 2020, 01:29:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Surrogate

James, can you attach there your document ?
If yes, delete all confidential and meaningfull information ! Just few shapes and connectors between them

jimibray

Hi Surrogate,

Hopefully this attachment uploads  :)

Surrogate

#17
in your example cell have formula Prop.Conn&"-"&Prop.Ref_Des, which contain concatenation
when your macro try get it formula and set to other shape's cell it convert to string (not formula).

in cell Prop.ConX always use formula "Prop.Conn&"-"&Prop.Ref_Des" ?

jimibray

Prop.Conx is always this formula
=Prop.Conn&"-"&Prop.Ref_Des

In the wire shape it needs to reference Prop.Conx of the shapes it's connected to in the Prop.To and Prop.From cells.

Ultimately I'd like to run a shape report on the wires and generate a wire list

Wire IDFromTo
Prop.Ref_DesProp.FromProp.To




Surrogate

IMHO You can get (read) property as string from cell User.Conx ! Where is these sub-strings are concatenated.
                        If EP.FromPart = visBegin Then
                            ' Get shape this end is attached to
                            Set shpFrom = EP.ToSheet
                            ' Pull Prop into shape
                            shp.CellsU("Prop.From").FormulaU = shpFrom.CellsU("User.Conx").ResultStr("")
                        Else
                            ' Get shape this end is attached to
                            Set shpTo = EP.ToSheet
                            ' Pull Prop into shape
                            shp.CellsU("Prop.To").FormulaU = shpTo.CellsU("User.Conx").ResultStr("")
                        End If
                    Next

But if you change some connections, values in Prop.To/Prop.From don't updated.

Surrogate

                    For i = 1 To cnxEndPoints.Count
                        Set EP = cnxEndPoints(i)
                        If EP.FromPart = visBegin Then
                            ' Get shape this end is attached to
                            Set shpFrom = EP.ToSheet
                            ' Pull Prop into shape
                             ' in next line of code you define shpFrom and create reference to prop.conx property of this shape !
                            shp.CellsU("Prop.From").FormulaU = "sheet." & shpFrom.ID & "!prop.Conx"
                        Else
                            ' Get shape this end is attached to
                            Set shpTo = EP.ToSheet
                            ' Pull Prop into shape
                            ' in next line you define  shpTo and create reference to prop.conx property of this shape !
                            shp.CellsU("Prop.To").FormulaU = "sheet." & shpTo.ID & "!prop.Conx"
                        End If
                    Next

jimibray

Hi Surrogate,

The second block of code you posted is working perfectly :) if I change the connectivity in the diagram and re-run the macro it updates the connectivity!

Thanks so much for helping, you're a hero!!!

-James

Surrogate

#22
James, thank you !
But i rarely use automation with connectors, in Russian forum our member share own repository
https://github.com/gtfox/SAPR_ASU
With great automation like this