News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Shape Data (Calculator)

Started by coryryder, August 28, 2018, 09:33:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

coryryder

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.

Cory

wapperdude

Visio 2019 Pro

coryryder

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



Also Do I have to put in verification letters and answer 4 questions each reply and post?
Cory

vojo

June....you might want to jump in here RE your calculation shapes from a few years ago.

http://june.minibird.jp/

wapperdude

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.
Visio 2019 Pro

coryryder

Ok so I'm using 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

Cory

wapperdude

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
Visio 2019 Pro

coryryder

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)"



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





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...

Cory

metuemre

Can you please share visio drawing of below picture so that we can work on the drawing directly?


coryryder

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


Cory

coryryder

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/
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

Cory

Yacine

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
Yacine

Yacine

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:
Yacine

coryryder

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???

Cory

Yacine

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 ;).
Yacine

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 465 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1277KB.
Tokens: post-login.
Cache hits: 14: 0.00202s for 26,725 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]