Author Topic: Shape Connection Info  (Read 673 times)

0 Members and 1 Guest are viewing this topic.

Surrogate

  • Hero Member
  • *****
  • Posts: 1028
    • ShapeSheet™ Knowledge Base
Re: Shape Connection Info
« Reply #15 on: September 10, 2020, 04:58:34 AM »
James, can you attach there your document ?
If yes, delete all confidential and meaningfull information ! Just few shapes and connectors between them

jimibray

  • Jr. Member
  • **
  • Posts: 21
Re: Shape Connection Info
« Reply #16 on: September 10, 2020, 05:10:36 AM »
Hi Surrogate,

Hopefully this attachment uploads  :)

Surrogate

  • Hero Member
  • *****
  • Posts: 1028
    • ShapeSheet™ Knowledge Base
Re: Shape Connection Info
« Reply #17 on: September 10, 2020, 05:32:17 AM »
in your example cell have formula
Code
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" ?
« Last Edit: September 10, 2020, 05:37:27 AM by Surrogate »

jimibray

  • Jr. Member
  • **
  • Posts: 21
Re: Shape Connection Info
« Reply #18 on: September 10, 2020, 05:49:58 AM »
Prop.Conx is always this formula
Code
=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

  • Hero Member
  • *****
  • Posts: 1028
    • ShapeSheet™ Knowledge Base
Re: Shape Connection Info
« Reply #19 on: September 10, 2020, 08:52:02 AM »
IMHO You can get (read) property as string from cell User.Conx ! Where is these sub-strings are concatenated.
Code
                        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

  • Hero Member
  • *****
  • Posts: 1028
    • ShapeSheet™ Knowledge Base
Re: Shape Connection Info
« Reply #20 on: September 10, 2020, 09:24:45 AM »
Code
                    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

  • Jr. Member
  • **
  • Posts: 21
Re: Shape Connection Info
« Reply #21 on: September 10, 2020, 09:37:34 AM »
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

  • Hero Member
  • *****
  • Posts: 1028
    • ShapeSheet™ Knowledge Base
Re: Shape Connection Info
« Reply #22 on: September 11, 2020, 02:23:00 AM »
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
« Last Edit: September 11, 2020, 02:59:03 AM by Surrogate »