Visio Guy

Visio Discussions => General Visio => Topic started by: coryryder on August 28, 2018, 09:33:13 PM

Title: Shape Data (Calculator)
Post by: coryryder on August 28, 2018, 09:33:13 PM
Below is an image a sample of designs I make in Visio.
I'm trying to find out if I can add shape data to each splitter/amp and calculate the result on the hubs.

(https://i.imgur.com/1V0rC87.png)
Title: Re: Shape Data (Calculator)
Post by: wapperdude on August 29, 2018, 01:58:12 AM
Take a look at this post:  http://visguy.com/vgforum/index.php?topic=1714.0 (http://visguy.com/vgforum/index.php?topic=1714.0)

Wapperdude
Title: Re: Shape Data (Calculator)
Post by: coryryder on August 29, 2018, 02:35:13 PM
Quote from: wapperdude on August 29, 2018, 01:58:12 AM
Take a look at this post...

I don't quite understand whats going on there....below is basically what I want where the squares have a set value and the circles show the value of all the squares that are connected to the circle

(https://i.imgur.com/M8UI6SQ.png)

Also Do I have to put in verification letters and answer 4 questions each reply and post?
Title: Re: Shape Data (Calculator)
Post by: vojo on August 29, 2018, 02:45:46 PM
June....you might want to jump in here RE your calculation shapes from a few years ago.

http://june.minibird.jp/
Title: Re: Shape Data (Calculator)
Post by: wapperdude on August 29, 2018, 03:18:13 PM
QuoteAlso Do I have to put in verification letters and answer 4 questions each reply and post?

Shouldn't.  Once you've successfully completed the registration process, then you just to login with your password.
Title: Re: Shape Data (Calculator)
Post by: coryryder on September 10, 2018, 04:04:50 PM
Ok so I'm using http://www.geocities.jp/visualcalculation/english/index.html (http://www.geocities.jp/visualcalculation/english/index.html)

I figured out how to use the "minus" stencil and modify it to subtract any fixed number i want and the connectors work great as "coaxial cable" and show the result '
Now I'm puzzled trying to add outputs. The "minus" has an "input" and "ouput" and im trying to represent a tv splitter lets say for example a 2-way splitter that has 4db of loss

look at the picture below ive added "Output2" in the datasheet for what i  think is all the information i would need but get an error that its not a connection point when trying to attach connector to it...

Once I figure this out I should be able to add multiple outputs create my own splitter looking shapes and have a great tool to help me design! At least saving me from manual calculations that is

(https://i.imgur.com/YMuUpVu.png)
Title: Re: Shape Data (Calculator)
Post by: wapperdude on September 10, 2018, 06:26:02 PM
Is there a reason for assigning the connection points to the controls?  Typically, the connection points don't move around, so this is not necessary...eliminate the controls.

Another option, don't allow controls to be glued.  Seems like Visio is gluing to the control point and not the connection point.

Wapperdude
Title: Re: Shape Data (Calculator)
Post by: coryryder on September 12, 2018, 07:54:42 PM
Quote from: wapperdude on September 10, 2018, 06:26:02 PM
Is there a reason for assigning the connection points to the controls?...

Wapperdude

not really sure what I'm doing....

Just inserted rows and copy/paste changing the name to output2 so it was different

Anyway...

Played around with the "Branch Shape" in the Decimal Calculation stencil since it had multiple outputs.
In "Shape Data" I changed the Value in the Prop.Output and Prop.OutputBottom from "GUARD(Prop.Input)" to "GUARD(Prop.Input-4)"

(https://i.imgur.com/1qGBvZv.png)

So that's progress I guess

But I'm still unsure how i could add my own connection points.....


Also another challenging thing is I need 2 values calculated at once

(https://i.imgur.com/U0Y9fv7.png?1)



Unfortunately this is the easy part since these devices have fixed values , after the hub we have cable loss which is based per/meter and all the cable frequencies from 55MHz to 860MHz (133 options)

Would be great is if Visio could do everything...

Title: Re: Shape Data (Calculator)
Post by: metuemre on September 14, 2018, 06:31:29 AM
Can you please share visio drawing of below picture so that we can work on the drawing directly?

Title: Re: Shape Data (Calculator)
Post by: coryryder on September 14, 2018, 05:33:01 PM
Quote from: metuemre on September 14, 2018, 06:31:29 AM
Can you please share visio drawing of below picture so that we can work on the drawing directly?

Cant upload more than 500k on here

I put it on my google drive

Here's a link to the download https://drive.google.com/open?id=1APWF9yaWs6qN_BsPaKysWAJbZVgFHltV (https://drive.google.com/open?id=1APWF9yaWs6qN_BsPaKysWAJbZVgFHltV)


Title: Re: Shape Data (Calculator)
Post by: coryryder on September 14, 2018, 09:32:24 PM
Update:

I was able to format the connector to show 2 values thanks to http://www.visguy.com/2008/11/19/title-block-2-lets-make-a-multi-field-smartshape/ (http://www.visguy.com/2008/11/19/title-block-2-lets-make-a-multi-field-smartshape/)
Look for "Insert the Field Value into the Shape's Text" on that page..

it still only calculates "Row_1" because of the VBA code I just need modify this code to calculate "Row_2" or whatever I name the other Prop

QuoteOption Explicit
'// <copyright> Copyright (c) 2008 Junichi Yoda. All rights reserved.
'// </copyright>

Private WithEvents myPage As Visio.Page

Sub SetPage()
    Set myPage = Nothing
    Set myPage = ActivePage
End Sub

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
    Set myPage = ActivePage
End Sub

Private Sub myPage_ConnectionsAdded(ByVal Connects As IVConnects)
    Dim Con As Visio.Connect
    Dim toCon As Visio.Connect
    Dim shp As Visio.Shape
    Dim myCell As Visio.Cell
'    Dim CountCon As Long
'    Dim AlreadyConnected As Boolean
    Dim myFormula As String
    For Each Con In Connects
        If Connects.FromSheet.Master.Name Like "VECTOR*" Then Exit Sub
'        MsgBox Connects.FromSheet.Name & " , " & Con.FromCell.Name & "  to " & Connects.ToSheet.Name & " , " & Con.ToCell.Name
        If Con.ToCell.Name Like "*Input.X" Then
'            MsgBox "Change Formula of shape input!"
            If Con.FromCell.Name = "EndX" Then
'                For Each toCon In Connects.ToSheet.FromConnects
'                   If toCon.ToCell Is Con.ToCell Then
'                        CountCon = CountCon + 1
'                   End If
'                Next
                If NumConnectionOnPoint(Con) <= 1 Then
                    myFormula = "Guard(sheet." & Connects.FromSheet.ID & "!Prop.Row_1)"
'                    myFormula = "Guard(" & Connects.FromSheet.NameU & "!Prop.Row_1)"
                    Set shp = Connects.ToSheet
'                    Set myCell = shp.Cells("Prop.input")
'                    Debug.Print myFormula
'                    myCell.FormulaForce = "Guard(sheet.22!Prop.Row_1)"
                    shp.Cells(PropCellName(Con.ToCell.Name)).FormulaForce = myFormula
'                    Connects.ToSheet.Cells(PropCellName(Con.ToCell.Name)).FormulaForce = myFormula
                Else
                   
                    MsgBox "Only one is possible!", vbExclamation, "Connector"
                    DoUndo
                End If
            Else
                If Connects.FromSheet.Connects.Count = 1 Then
                    Connects.FromSheet.SwapEnds
                Else
                    MsgBox "Connect head!", vbExclamation, "Connector"
                    DoUndo
                End If
            End If
        ElseIf Con.ToCell.Name Like "*Output.X" Then
'            MsgBox "Change formula of connector!"
'            Debug.Print Connects.FromSheet.Cells("Prop.Row_1").Name
            If Con.FromCell.Name = "BeginX" Then
'                For Each toCon In Connects.ToSheet.FromConnects
'                   If toCon.ToCell Is Con.ToCell Then
'                        CountCon = CountCon + 1
'                   End If
'                Next
               
                If NumConnectionOnPoint(Con) <= 1 Then
                    myFormula = "Guard(sheet." & Connects.ToSheet.ID & "!" & PropCellName(Con.ToCell.Name) & ")"
                    Connects.FromSheet.Cells("Prop.Row_1").FormulaForce = myFormula
                Else
                    MsgBox "Only one is possible!", vbExclamation, "Connector"
                    DoUndo
                End If
            Else
                If Connects.FromSheet.Connects.Count = 1 Then
                        Connects.FromSheet.SwapEnds
                Else
                    MsgBox "Connect tail!", vbExclamation, "Connector"
                    DoUndo
                End If
            End If
        Else
            MsgBox "Connect to a Connecting Point.", vbExclamation, "Connector"
            DoUndo
'            MsgBox "Change formula of shape at " & Con.ToCell.Name
'            myFormula = "Guard(" & Connects.FromSheet.Name & "!Prop.Row_1)"
'            Connects.ToSheet.Cells(PropCellName(Con.FromCell.Name)).FormulaForce = myFormula
        End If
    Next
End Sub

Function NumConnectionOnPoint(Con As Visio.Connect) As Long
    Dim CountCon As Long
    Dim toCon As Visio.Connect
    For Each toCon In Con.ToSheet.FromConnects
       If toCon.ToCell Is Con.ToCell Then
            CountCon = CountCon + 1
       End If
    Next
    NumConnectionOnPoint = CountCon
End Function

Function PropCellName(ConnectorCellName As String) As String
    Dim strRight As String
    Dim strLeft As String
    strRight = Right(ConnectorCellName, Len(ConnectorCellName) - 12)
    strLeft = Left(strRight, Len(strRight) - 2)
    PropCellName = "Prop." & strLeft
End Function

Private Sub myPage_PageChanged(ByVal Page As IVPage)
    SetPage
End Sub

Title: Re: Shape Data (Calculator)
Post by: Yacine on September 15, 2018, 10:54:26 AM
Hi Cory,

I had a look at your request and since Junichi's and my stuff where too complicated, I thought I could simplify the solution and write something more generic.

Junichi's ConnectIt routine relayed on shapes prepared with input and output cells.
Here's a more generic approach, where only the connectors are "smart".
When either their ends or begins are connected to a shape they raise a dialog asking to which cell they should connect. If the cell does not exist, the routine offers the possibility to create it.
The calculation flow is fixed. It is always Source shape --> connector carries the value in "user.value" --> target shape.
When the beginning of the connector is connected it writes a reference to the source in the connector.
When the end of the connector is connected it writes a reference to the connector in the target shape.
The calculation to preform needs to be written in the target shape itself. No automation here.

Use the yellow square in the stencil to set up the connector (or use a prepared one). Drop it on the drawing to start the dialog.
The source shapes don't need setup.
The target shapes get prepared by the connectors.

There's however one BIGGER problem, I couldn't solve: stopping the connector changed trigger. I needed several times to interrupt the macro and step slowly through it to interrupt the calls.

HTH,
Yacine
Title: Re: Shape Data (Calculator)
Post by: Yacine on September 15, 2018, 10:55:59 AM
Use the above posted Stencil in the documents where you need to edit the calculations.
An example drawing (Zeichnung1) is enclosed as well.

A screenshot of the example is here:
Title: Re: Shape Data (Calculator)
Post by: coryryder on September 15, 2018, 02:20:27 PM
Quote from: Yacine on September 15, 2018, 10:54:26 AM

...Use the yellow square in the stencil to set up the connector (or use a prepared one). Drop it on the drawing to start the dialog...


Hi Yacine,

I tried to run the dialog box and nothing happens when I click.

What am I doing wrong???

(https://i.imgur.com/rkT11KU.png)
Title: Re: Shape Data (Calculator)
Post by: Yacine on September 15, 2018, 04:44:57 PM
When an arbitrary (not yet prepared) connector is selected, press the button, now the connector has the behaviour to transmit the value from a source to a target shape.
I thought "Setup selected connector" would suffice to explain its function. May be a native speaker, could improve the text ;).
Title: Re: Shape Data (Calculator)
Post by: metuemre on September 17, 2018, 10:58:47 AM
Attached is my approach to the problem. Just drop equipments from the document stencil to the page, enter their loss values in shape data, connect them via Coax shape in the document stencil, calculations will be handled automatically.

Please note that connections has to be made to the connection points, not to the shape or to the geometry or anywhere else.
Title: Re: Shape Data (Calculator)
Post by: coryryder on September 17, 2018, 09:10:24 PM
Quote from: metuemre on September 17, 2018, 10:58:47 AM
Attached is my approach to the problem...

This is it !!!!! SOLVED!!! THANKS!
Title: Re: Shape Data (Calculator)
Post by: wapperdude on September 18, 2018, 12:39:52 AM
@metuemre:  is your solution compatible with older Visio versions?  If so, like to see vex version.

Wapperdude
Title: Re: Shape Data (Calculator)
Post by: metuemre on September 18, 2018, 06:17:57 AM
@wapperdude, please find below the link to .vsd file.

https://www.dropbox.com/s/s71mpoqbshge4mp/signal%20loss%20example.vsd (https://www.dropbox.com/s/s71mpoqbshge4mp/signal%20loss%20example.vsd)
Title: Re: Shape Data (Calculator)
Post by: Yacine on September 18, 2018, 03:15:44 PM
@metuemre, Chapeau! :)
Title: Re: Shape Data (Calculator)
Post by: coryryder on September 18, 2018, 05:08:02 PM
Quote from: metuemre on September 17, 2018, 10:58:47 AM
Attached is my approach to the problem...

metuemre,

So we have 4 other devices that we use see attached.
Could you do me one last favor and add these devices?

I tried to manually enter in everything to my other splitters but failed.
I understand the logic behind whats being done, but can't produce exactly the same result as yours.
I have a million connection points on my splitters and even if I were to delete them all and only make the necessary connectors would they be at the group level or shape level?

I tried ungrouping your splitter and regrouping and it destroys everything


Also I changed the text to show as ##/## verses Low: ##
                                                                         High: ##

added the option to double click on the Amp to change settings
also updated the EQ as it loses -6 on low end and -1 on high end I think you may have had it set to losing 5 on both or something

One thing to note the 3 way splitters I added one is named 3U, just means unbalanced so it loses -4 on one output and -7 on others

Thank you so much!!!!
Title: Re: Shape Data (Calculator)
Post by: metuemre on September 19, 2018, 08:29:20 AM
@Yacine, thanks  :D

@coryryder, I added those devices as well and put all the shapes and VBA code into a stencil so that you can access and distribute it easily. I'm not sure about the correctness of the calculations, you can modify them if you need. You're welcome, buddy  ;)

Title: Re: Shape Data (Calculator)
Post by: coryryder on September 24, 2018, 02:42:54 PM
Quote from: metuemre on September 19, 2018, 08:29:20 AM

I added those devices....

You are the man!

Thanks again!