Main Menu

Recent posts

#81
General Visio / Re: Multi line shape
Last post by wapperdude - April 23, 2024, 08:57:48 PM
Doh!  Yeah. Pretty sure all of us forgot.   ;D
#82
General Visio / Re: Why does Visio show two di...
Last post by Nikolay - April 23, 2024, 08:57:30 PM
It is not an issue, it is a feature.

Shape Sheet is considered developer tool, and uses the "internal" locale (i.e. English)
Shape Data window is considered a user tool, and uses the system locale (i.e. German)

English: "0.25" (dot as separator)
German: "0,25" (comma as separator)

This is just according to the language grammar rules.
English-speaking people are actually using dot to separate the decimal (fractional) part, even in real life!

Here is an interesting map of "dot people" vs "comma people"


https://en.wikipedia.org/wiki/Decimal_separator
#83
General Visio / Re: Multi line shape
Last post by Erik A - April 23, 2024, 08:16:21 PM
thanks everyone. i managed to work it out. Wapperdude jogged my memory on how to do it. draw A to B. use pencil tool and hover over end point and it will pop up with extend. or click on the end point and it will change to move endpoint.
#84
General Visio / Re: Why does Visio show two di...
Last post by wapperdude - April 23, 2024, 07:43:39 PM
Yes.  That's the one that came to mind.
#85
ShapeSheet & Smart Shapes / Re: SETATREF(Height) / EventXF...
Last post by wapperdude - April 23, 2024, 07:40:28 PM
Couple additional notes: 
>  Your usage of SETATREF is not correct.  The cell reference is intended to be the target for action, not the trigger.  Instead, use CALLTHIS("ConnPtAdjust")+DEPENDSON("Height").  For reference, see https://learn.microsoft.com/en-us/office/client-developer/visio/setatref-function and https://visguy.com/vgforum/index.php?topic=6383.msg26308#msg26308  This applies to all 3 of your SETATREF formulae.

>  I'm having trouble getting the code to run manually, but don't have time to investigate.  However, I recommend deconstructiong it, without the error stuff and without the auto-triggering.  Just add rows and delete.  You can step thru using <F8>, and you can set execution breakpoints.  There should not be any re-triggering.  Keep the control point count low.  I'm not convinced the code fully restricts adding / deleting.  Then, add the +Dependson statement in shapesheet.  Keep breakpoints in code.  See if behavior is as desired.  Finally, remove breakpoints and let code fully run.

>  As resizing the height is the trigger, moving should not be an issue.  Also, duplicating should not be an issue if the code is properly checking row count and connection position. There should not be any retriggering, or if there is, it's of no consequence.
#86
General Visio / Re: Why does Visio show two di...
Last post by Surrogate - April 23, 2024, 06:44:49 PM
Quote from: wapperdude on April 23, 2024, 04:15:07 PMThere was a discussion, not too long ago, related to this, but don't recall specifics.
Do you mean this thread?
#87
ShapeSheet & Smart Shapes / Re: SETATREF(Height) / EventXF...
Last post by Yacine - April 23, 2024, 06:00:50 PM
Your observation is right. When you drag something (shape or size handle) the event gets fired multiple times. You can observe this if you run the events manager.

Why not put the macro on an action command (right button menu, then deliberately run the command)

Other option, but slightly more complex. Let the macro know that you've finished the resizing.
Define a general variable to hold the time. You're macro checks first the time between the current call and the value stored. If difference is small (threshold), it stores the current time in the global variable and leaves, otherwise it runs the actually intended code.

'*******************************
Public lastcall As Double
'*******************************


Sub ConnPtAdjust(shp As Visio.Shape)
    ' this will add remove conection points from some shapes - Box, Device, EGSE after shape is resized
    ' this macro is called from the shapesheet of the resized shape
    ' shp is passed into this routine from when it is called within the shapesheet
   
    ' connections points for these shapes are defined from the top down (connection point 1 and 2 are top/bot mid; cp3,4 is upper most left/right; cp5,6 are cps below 3,4
    ' additional connection points req to be added if last connection point Y value is >= 0.875 inches
    ' connection points req to be deleted if last connection point Y values is < 0.875 inches
   
    Dim connPtRow As Integer    ' row identifier of last connection point
    Dim UndoScopeID1 As Long
    Dim lastCPYVal As Single    ' y value of last connection point (zero based)
    Dim rowsToAdd As Integer    ' number of connection point rows we need to add to vba formula is 0 based. for shapesheet formulas it is one-based
    Dim rowNew As Integer      ' the row we just added
    Dim i As Integer
       
    Dim currentTime As Date
    Dim milliseconds As Double
    currentTime = Now()
'*******************************
    If Timer - lastcall < 100 Then
      lastcall = Timer
      Exit Sub
    End If
'*******************************

....

#88
ShapeSheet & Smart Shapes / Re: SETATREF(Height) / EventXF...
Last post by MacGyver - April 23, 2024, 05:14:48 PM
Another weird characteristic I've noticed is that when my macro is run multiple times. The various routine's appear to be running in parallel. As in one the first run of the routine may not have finished running before the second instance of the routine is executed.

I added code to debug.print start/stop times of an otherwise empty macro.  I then added some code that throws an intentional error.  The debug window shows that the macro started 6 times, and only ended once.  If the intentional error is removed, the macro was started some random number of times and ended some random number of times.
#89
ShapeSheet & Smart Shapes / SETATREF(Height) / EventXFMod ...
Last post by MacGyver - April 23, 2024, 04:19:25 PM
I'm attempting to run a macro when height of a shape is changed to dynamically adjust connection points.  I'm running into an issue that appears others have run into (similar topic)

I've attempted using CALLTHIS in a user cell like such:
=SETATREF(Height,CALLTHIS("ConnPtAdjust"))And the ConnPtAdjust macro gets executed anywhere from 4-20 times.  I've attempted moving the code to the EventXFMod Behavior as well and same result - code is executed multiple times. 

The real oddity is if i toss a break in there for debug purposes, code functionality works exactly as expected.  If no break, it executes between 4 and 20 times.  Even adjusted my code so that called routine only debug prints the time to verify it wasn't my code causing the error and same results.

I changed from CALLTHIS to use RUNMACRO (and forgot to remove the visShape as input) and it errored out multiple times.  I have added various wait times to my code which also doesn't fix the issue.  Attached the drawing with shape in question, and included code that gets executed.

Any thoughts/tips would be greatly appreciated!
#90
General Visio / Re: Why does Visio show two di...
Last post by wapperdude - April 23, 2024, 04:15:07 PM
Technically, yes.  But it would be expected as decimal separator is always a period in English system.  I suspect that since Visio internally uses English system, then, within shapesheet enties, it would expect the period. Haven't tried to change the language and/or the separator.  There was a discussion, not too long ago, related to this, but don't recall specifics.