How can i glue to a specific point of the dynamic connector

Started by ivan, February 22, 2010, 10:19:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ivan

see image attached. i want to connect blue connector to the green one as shown (i.e
con - is a green connector, con1 - blue one
i can set a cell
           Set vsoCell1 = con1.CellsU("EndX")
           vsoCell1.GlueTo con.CellsU("Geometry1.X2")

or
           Set vsoCell1 = con1.CellsU("EndX")
           vsoCell1.GlueTo con.CellsU("Geometry1.Y2")

but how can i set both coordinates to get correct result ?

sorry, forgot the image :(


Visio Guy

GlueToPos might help.

I'm not sure if you can glue to Geometry - usually you glue to a Connection point. So the Connector would have to have a connection point at the place where Geometry1.X/Y2 is.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

ivan

sorry. forgot the image :(
i tried to record the macro
i got
vsoCell1.GlueToPos Application.ActiveWindow.Page.Shapes.ItemFromID(426), -0.25, 0#
but if i try
           Set vsoCell1 = con1.CellsU("EndX")
            vsoCell1.GlueToPos con,-0.25, 0#

result is incorrect too - it's connected to connector start (wher it's connected to the box)

Paul Herber

I feel you should make the blue connector join to the component (resistor?) rather than the green connector.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

ivan

QuoteI feel you should make the blue connector join to the component (resistor?) rather than the green connector.
it's peace of cake ;) but i need to glue to connector

i guess i have to create connection cell first. then glue to it...
    con.AddRow visSectionConnectionPts, 1, visCnnctX
    con.CellsSRC(visSectionConnectionPts, 1, visCnnctX).FormulaU = "Geometry1.X2"
    con.CellsSRC(visSectionConnectionPts, 1, visCnnctY).FormulaU = "Geometry1.Y2"

not working  ;( what's wrong ? how can i add one more row to connections section ?


wapperdude

Unless I'm missing something, enable Glue to shape geometry.  This will give you a "dotless" connection -- my personal preference.  However, for those who like to connect the dots, then on the Transmission Paths stencil, there are two valuable shapes.  First is the "Junction", and the second is the "Junction/crossing".  

Junction is just a dot with a connection point.  The J/C can be set to be either a 4-way or a "T-connection."

HTH
Wapperdude

Edit -- My bad.  Totally missed you're doing this by code.  Doh!  Anyway, the "Junction" shape already exists if you chose to use it.
Visio 2019 Pro

Visio Guy

When you set the x and y formulas, you need to be sure that the row index is "1". Perhaps it is 0 or 2?


   ' You can get the row index, I think:
   dim iConnRow as Integer
   iConnRow  = con.AddRow ( visSectionConnectionPts, 1, visCnnctX )
   con.CellsSRC(visSectionConnectionPts, iConnRow , visCnnctX).FormulaU = "Geometry1.X2"
   con.CellsSRC(visSectionConnectionPts, iConnRow , visCnnctY).FormulaU = "Geometry1.Y2"
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

ivan

Quoteyou need to be sure that the row index is "1". Perhaps it is 0 or 2?
and how can i be sure ? how can i get existing rows count ?

Visio Guy

shp.RowCount( section )

Also, the "iConnRow = ..." code sample I added in my previous post is getting exactly the row that you added.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

ivan

just tried your example. strange results for some goddamn reason connection point adds in wrong place - at the middle of vertical line
if i open connector shape sheet after macros is done i see coords in mm
like "-1.25 mm" for X "6.5 mm" for Y. but t only works correctly if it's set to formula "Geometry1.X2" "Geometry1.Y2".
thus how can i set connection point coordinate to "=Geometry1.X2" not just "-1.25 mm" ?


another example
QuoteiConnRow = con.AddRow(visSectionConnectionPts, 1, visCnnctX)
    'Debug.Print "iConnRow " & iConnRow
   
    con.AddSection visSectionScratch
    con.AddRow visSectionScratch, visRowLast, visTagDefault
   
    con.CellsSRC(visSectionScratch, 0, visScratchA).FormulaU = "Geometry1.X2"
    con.CellsSRC(visSectionScratch, 0, visScratchB).FormulaU = "Geometry1.Y2"
   
   
    con.CellsSRC(visSectionConnectionPts, iConnRow, visCnnctX).FormulaU = "Geometry1.X2"
    con.CellsSRC(visSectionConnectionPts, iConnRow, visCnnctY).FormulaU = "Geometry1.Y2"
the i check shape sheet of this shape. i see "Geometry1.X2" in Scratch, but "-1.25 mm" in connection points X. WTF ?
iven tried
    con.CellsSRC(visSectionConnectionPts, 0, visCnnctX).FormulaU = "Scratch.A1"
    con.CellsSRC(visSectionConnectionPts, 0, visCnnctY).FormulaU = "Scratch.B1"

with no luck though :(