Main Menu

Recent posts

#1
Programming & Code / Re: Python ... again
Last post by Thomas Winkel - Today at 01:50:08 PM
Ahh... you use Python as a "Visio Terminal". That's a great idea indeed!
I will try that :)
#2
General Visio / Re: How to only change the gro...
Last post by Nikolay - Today at 01:35:44 PM
No easy way to do that (i.e. nothing like "hold CTRL key when applying")
You can change the ShapeSheet cell "HAlign" for that group shape directly, though.
Meaning, open the ShapeSheet, and change the value in "HAlign" cell
#3
Programming & Code / Re: Python ... again
Last post by Yacine - Today at 01:09:16 PM
Well, when I write REPL, I mean that I use the Jupyter Notebook as a line command tool.

Say I want to select the valves that belong to machine x1

vWin.DeselectAll()
for shp in vPg-Shapes:
  if shp.CellExists("prop.machine", False):
    if shp.Cells("prop.machine").ResultStr("") == "x1":
      vWin.Select(shp, visSelect)

Now this is not very impressive.

But it if I were to need that again, I can either repeat running the cell (The notebook is still open and I can navigate it)
Or I can decide to make a function out of the previously entered code, just be adding a def and a function name.

I may as well decide to parameterize this function, so I would replace the hard coded "machine" and "x1" by variables and use the function as generic selection tool for different prop fields and values.

Basically in such scenario I don't start with the idea to write a program, but use simple code lines for repetitive tasks. Only when functions proof their usefulness, I move them to a library for later re-use. "The program writes itself".

It is specially the data structures in Python that makes it so attractive.

Having collected all relevant shapes by a snippet like above, I could then easily define the list of valves belong to x1:
valves_x1 = [shp for shp in shps if prop_is(shp,"machine","x1") and prop_is(shp,"type","valve") ]
That is a one-liner that would require quite a bunch of code in VBA.



#4
General Visio / Re: How to only change the gro...
Last post by Surrogate - Today at 11:08:24 AM
Quote from: Visisthebest on Today at 09:21:35 AMHow can I only change the group shape in the Visio UI without changing the subshapes?
If we are talking about changing the alignment of a text block in the group shape.It is enough to open the text block of group shape for editing. I prefer to use the F2 key for this.
#5
Deployment / Re: Online Shapes Library
Last post by Thomas Winkel - Today at 10:32:43 AM
Quote from: Nikolay on April 27, 2024, 02:31:34 PMBTW, I was thinking about similar online storage, but on the base of GitHub (i.e. no backend/no python app at all).
The authentication is done via GitHub login.
People can contribute stencils/shapes by creating a pull requests to the repository.
The repository is exposed via GitHub itself (i.e. using GitHub pages).
Also no payment for hosting required then, imho this is the only way to make site live long (years)

Interesting.
Contributors would need a local repository to commit stencils or documents.
User could download from GitHub Pages or could also sync a local repository to have everything available (even offline).
Right?
I think this is a robust solution.
In our company we do similar (but without website) using SVN.
The reason for SVN was because it is able to lock files, allowing only one write access at a time.
This is the only way to protect binary files from conflicts caused by parallel modifications.

Quote from: Nikolay on April 14, 2024, 07:12:41 PMFor a company, you can configure a shared folder with stencils/templates, and that's it. The shape search should work, the stencils/templates should show up in the "new".
This shape search does not work four our company solution.
We configure the stencil path (to the local SVN checkout) in File -> Options -> Advanced -> File Locations
I never checked that before, but this search also does not work with stencils that are installed with your Extended Visio Addin Project.
(Not even if the stencil is open.)
#6
General Visio / Re: How to only change the gro...
Last post by Thomas Winkel - Today at 10:12:48 AM
I don't know if this can be done easy for "finished" group shapes.
But you could protect the sub-shapes using GUARD().
#7
Programming & Code / Re: Python ... again
Last post by Thomas Winkel - Today at 10:04:19 AM
Hi Yacine,

interesting topic.
My first contact to Python is the Online Shape Library because I decided to use Flask on server side.
There I also use win32com.client to fill the database because I thought it could be easier to access Visio from Python than accessing the database from VBA (and because I wanted to try it out).
For this project I use VSCode.

I think JupyterLab is a great MATLAB replacement for data analysis, control engineering and scientific calculations.
Thus, everywhere plots or descriptive flows are required for presentation.
But at the moment I do not see a benefit for Visio automation here...?

For me the main barrier using Visio with Python is the lack of IntelliSence as it comes with the VBA Editor or Visual Studio:
Auto-complete, function/parameter description, etc..
In VBA you can even edit the code or change the current execution line while debugging!
For me that makes VBA the best prototyping platform (if Visio is the focus).

On the other hand VBA comes to limits as the project grows or for "professional" projects.
It's not good for collaborative work on the same (binary) files.
Also there are no reasonable solutions for things like DataGridView, TreeView, Newtonsoft-JSON, etc. available.

So, in my opinion:
* If it's satisfying go with VBA
* If VBA is not satisfying go with a .NET AddIn
* Everything else to integrate Visio in another environment (depending on your project and skills)

Anyway, I really like Python and am currently spending some time learning how to use it for server-side applications.
#8
General Visio / How to only change the group s...
Last post by Visisthebest - Today at 09:21:35 AM
If I select a group shape with subshapes and change for instance the text settings from centered to left, the text in the subshapes also moves to the left.

How can I only change the group shape in the Visio UI without changing the subshapes?
#9
Visio Bugs (er...Issues) / Re: Visio 365 - Cannot link to...
Last post by wapperdude - May 02, 2024, 07:20:16 PM
If the problem persists, please upload file that has the issue.
#10
Programming & Code / Re: Python ... again
Last post by wapperdude - May 01, 2024, 11:25:24 PM
Take your location with you.  👀😲🙄😆