Changing Connector with line

Started by hamohd70, July 04, 2020, 06:20:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hamohd70

I have a complicated drawing create by a friend and used connectors in it. The problem I'm facing is when I try to group and rotate the shapes, the connector lines get messed-up.

Can I change connectors with line in in one shot- may be using VBA!

an example is here ..


it become like this..

Yacine

You could, but that would be pitty for the connectors. Try resetting the connectors. https://support.microsoft.com/en-gb/office/reset-the-path-of-a-connector-881e9ea6-f54a-4708-a0de-c42e24f33cac

If you still want to transform them into lines, use the join function https://docs.microsoft.com/en-us/office/vba/api/visio.selection.join
Yacine

Croc

You can also group multiple shapes. When you rotate the group, the configuration of the connectors within the group will remain unchanged.

hamohd70

Quote from: Yacine on July 04, 2020, 08:05:00 AM
You could, but that would be pitty for the connectors. Try resetting the connectors. https://support.microsoft.com/en-gb/office/reset-the-path-of-a-connector-881e9ea6-f54a-4708-a0de-c42e24f33cac

If you still want to transform them into lines, use the join function https://docs.microsoft.com/en-us/office/vba/api/visio.selection.join

This solution worked. Thanks.

hamohd70

Quote from: Croc on July 04, 2020, 08:54:22 AM
You can also group multiple shapes. When you rotate the group, the configuration of the connectors within the group will remain unchanged.

Unfortunately this did not work without the first solution.

Thanks.

wapperdude

#5
@Croc:  Not true.  Grouping does not fix this problem.

@All:
This connector re-routing thing has been a long time nuisance.

There are two things that will minimize / eliminate the problem.  Unfortunately, there's no global setting, and is on a per connector basis.  It can also involve all shapes that "participate" in the rotating scenario.  These steps include:
  1) Each connector must have its routing behavior set to As Needed.  Developer tab>Shape Design>Behavior>Connector tab>Reroute cell.

  2) Connectors must be glued to shape via literal connection points.  "Walking" glue does not elicit desired behavior.

I've attached a sample drawing to show.  The connectors are set to "freely" reroute.  There are 3 macros which can be run to change the behavior.  The main routine is RunRcsv.  It calls a 2nd sub that literally iterates thru every shape on the page, including subshapes of groups.  As this 2nd macro runs, it calls a 3rd macro that does the actual changes.  Thus, other or additional macros can be run to do other things.  Presently, just the one which changes the connector re-route property to "as needed" for EVERY connector on the page.

Here is the code:

Sub RunRcsv()
' This is the initiating macro, gets the page shape collection
' and calls ShapesColl2 recursive subroutine
' RcsvSrch calls sub to do desired changes
   RcsvSrch ActivePage.Shapes
End Sub

Private Sub RcsvSrch(ByVal shps As Shapes)
   Dim vShp As Shape
   For Each vShp In shps
       If vShp.Shapes.Count <> 0 Then RcsvSrch vShp.Shapes
       Call CnctrProp(vShp)
   Next vShp
End Sub

Private Sub CnctrProp(visShp As Shape)
    Set vShp = visShp
    vShp.CellsSRC(visSectionObject, visRowShapeLayout, visSLOConFixedCode).FormulaU = "1"
End Sub
Visio 2019 Pro

Croc

Quote@Croc:  Not true.  Grouping does not fix this problem.
And in Visio 2007 it works :)

Croc

wapperdude, do you know if Microsoft recognized this bug?
One of the main properties of the group is to isolate incoming shapes, to act as an intermediate parental level. Coordinates must be calculated within a group without regard to its movement or rotation. And this property has stopped working in recent versions of Visio.

wapperdude

#8
Really?!?  Very strange.   

My memory must be whacky.  Seems as far as I can recall, that has always been a problem.  Even with V2007... which, until recently, was my favorite version.  Sigh. 
I cannot go back and try.  Perhaps I'm remembering V2010 which was what was used at work???  Apologies. 

Unfortunately, I have no idea what M$ does.  Perhaps Visio Guy or Paul Herber.  I'm too low on the food chain.
Visio 2019 Pro