Main Menu

Recent posts

#1
Shapes & Templates / Re: Connector Shape Geometry Q...
Last post by wapperdude - May 31, 2024, 11:20:59 PM
 ;D   Surprised it didn't ask..."Who's Yacine?"  That would have been hilarious.

Just to be clear, my post was about the original post, not Yacine's 1st reply.  Think I'll go ask chatAI why 2 + 2 =4?
#2
Shapes & Templates / Re: Connector Shape Geometry Q...
Last post by Yacine - May 31, 2024, 09:24:40 PM
I thought, it would be clever to be lazy ... read my inquiry @ chatGPT. Quite funny.
https://chatgpt.com/share/3726e515-2234-4b67-a0c3-abef7453ca3e
#3
Shapes & Templates / Re: Connector Shape Geometry Q...
Last post by wapperdude - May 31, 2024, 08:11:04 PM
Pretty sure I've seen this before.  But, I've not been able to replicate the problem now.  I tend to concur with Yacine's conclusion.  Can you upload a sample file so something simple isn't overlooked?
#4
Shapes & Templates / Re: Connector Shape Geometry Q...
Last post by Yacine - May 31, 2024, 06:46:18 PM
Yes, very annoying this behavior and I wouldn't know of a simple solution.
However you can build your own connector.
You basically work with a 1D group shape and have straight lines in it.


P.S. Specially this exasperating fine tuning of connectors has led to be very strict with grids and connection points.
In cases, where I cannot avoid it, I help myself with connection points attached to control points. Very effective.
#5
Shapes & Templates / Connector Shape Geometry Quest...
Last post by Scott10284 - May 31, 2024, 11:56:06 AM
Is there a way to prevent a Connector shape from automatically straightening itself?

At times I would like to position a connector such that there is a very small "step" in the shape geometry and it responds by straightening itself out into a small slope instead. I have tried changing many different properties in the Behavior menu (such as setting the Connector Style to Right Angle), but none of them seem to work.

Is there a way to prevent this shape behavior?
#6
Programming & Code / Re: Looking for a list of dict...
Last post by Yacine - May 28, 2024, 06:32:31 PM
You're pointing to a very vast aspect of Visio. Data handling and exchange with external apps.
There are so many possibilities.

Just to name some.
- reports - they export directly to Excel if wished
- linking shapes to an external DB or Excel file with refresh and so on.
- opening data sources by code for reading and writing
- and probably many others ...

Your method, writing data in individual dictionaries looks indeed clunky. A collection would make more sense???

Very cheap, but efficient: build up a string with defined separators.
#7
ShapeSheet & Smart Shapes / Re: Formula Not Updating
Last post by wapperdude - May 28, 2024, 04:53:25 PM
The problem is TextWidth, it is defined for composed shape text, not general strings.  Syntax ~ TextWidth(theText).  See full fcn definition: https://learn.microsoft.com/en-us/office/client-developer/visio/textwidth-function

Is the Prop.BomTag the only text for this shape, and, the only way to edit the shapetext? 

If so, in the shapesheet Text Transform section, set the TxtWidth cell = TextWidth(theText), and  then, possible formula in the Width cell is:  guard(ceiling(txtwidth, 0.25))

I have replaced Floor with Ceiling such that rounding will always be larger than the text width.

There are other formulations possible using either SETF, or SETATREF functions.  Plus, you may need to protect shapetext editing.

#8
Programming & Code / Looking for a list of dictiona...
Last post by VisioForHVAC - May 28, 2024, 03:28:23 PM
I have a custom shape that identifies a part that needs to be ordered and added to the bill of material for the project. The shape has the following shape data fields, TAG, PART NO, QTY, MANUFACTURER, and DESCRIPTION. I am working on a VBA script that reads through all of these shapes and combines it into one list. Eventually I will want to export that list to Excel. I'm probably thinking a csv for that, but I haven't gotten there yet.

Right now, I use a separate dictionary for each shape data field. I use the "PART NO" entry as the key to keep them organized. I feel like this isn't very efficient and there is probably a better solution that I'm not thinking of. What I really want is a list of dictionaries with multiple key value pairs. Below is what I would do in python. Is there any way to do something similar to this in VBA? Does anyone have advice on a better approach? I'm still fairly new to VBA so any input is welcome.

ls = [
    {"tag": "A", "partNO": "a", "qty": "1", "manuf": "Manuf A", "description": "the letter a"},
    {"tag": "B", "partNO": "b", "qty": "1", "manuf": "Manuf B", "description": "the letter b"},
    {"tag": "C", "partNO": "c", "qty": "1", "manuf": "Manuf C", "description": "the letter c"},
    ]

print(ls)

Public Sub test()

Dim vPage As Visio.Page
Set vPage = ActivePage
   
Dim shp As Visio.Shape
Dim tag As String
Dim partNo As String
Dim qty As Integer
Dim manuf As String
Dim desc As String

Dim tagDict As New Dictionary
Dim partNoDict As New Dictionary
Dim qtyDict As New Dictionary
Dim manufDict As New Dictionary
Dim descDict As New Dictionary

For Each shp In vPage.Shapes
   
    If shp.CellExistsU("Prop.testTag" & THePropertyName, 0) Then             
       
        tag = UCase(shp.CellsU("Prop.tag").ResultStr(visNone))
        partNo = UCase(shp.CellsU("Prop.PartNo").ResultStr(visNone))
        qty = shp.CellsU("Prop.qty.Value").ResultInt(visNone, 0)
        manuf = UCase(shp.CellsU("Prop.manuf").ResultStr(visNone))
        desc = UCase(shp.CellsU("Prop.descr").ResultStr(visNone))

        If partNoDict.Exists(partNo) Then
            qtyDict(partNo) = qtyDict(partNo) + qty
        Else           
            tagDict.Add partNo, tag
            partNoDict.Add partNo, partNo
            qtyDict.Add partNo, qty
            manufDict.Add partNo, manuf
            descDict.Add partNo, descDict           
        End If   
    End If
Next
   
End Sub
#9
ShapeSheet & Smart Shapes / Formula Not Updating
Last post by VisioForHVAC - May 28, 2024, 03:03:40 PM
I have a custom shape with a shape data field where the user can enter text that shows upon the shape. I want the shape size to automatically adjust based on the length of the text. I used the following equitation in the Shape Transform -> Width section, "=GUARD(FLOOR(TEXTWIDTH(Prop.BomTag)+0.25,0.25))." This appears to work but for some reason it doesn't always update. I have to put the same text in multiple times to get the shape to re-size. I'm curious if anyone knows why it doesn't update automatically or advice on a better approach.
#10
General Visio / Re: Keep drawing maximized whe...
Last post by Yacine - May 27, 2024, 08:28:36 PM
My left foot was aching yesterday.  ;D