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

Online Shapes Library

Started by Thomas Winkel, April 14, 2024, 11:56:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thomas Winkel

Project on GitHub:
https://github.com/Visio-Resources/VisioOnlineShapesLibrary

Public Shapes Server:
https://www.visio-shapes.com/

Current Installer for Visio AddIn:
https://github.com/Visio-Resources/VisioOnlineShapesLibrary/releases/tag/v0.1.4

# News:
29.04.2024: Installer for the Visio AddIn (thanks, Nikolay!)

# TODO:
* Add stencils from Visio
* User management
* Rename / Edit / Delete
* Public / Private / Groups?
* Improve search / filter functions
* ... your ideas here

# Notes:
* Possible to pre-fetch DataObjects of visible shapes in JS?
* Store complete DataObject as serialized (and compressed?) Dict<string format, string data> (not only "Visio 15.0 Shapes")?





<<<<<<<<<<<<<<<<<<<<<< Original Post >>>>>>>>>>>>>>>>>>>>>>

Hi,

inspired by discussions in other topics I created a mockup of an online shapes library.
At the moment it is not more than a basic for discussions, but I hope it is a good illustration (see video).
All depends on the implementability of the key feature: Drag & Drop directly from the server to Visio (via AddIn).
Does anyone have an idea how to achieve this?

BR, Thomas

Video:
https://youtu.be/0KASmwGkDRU

Project on GitHub:
https://github.com/Visio-Resources/VisioOnlineShapesLibrary

Nikolay

#1
Great idea!
I've done the drag-n-drop for "production" addin (while saving shapes in db), but that was long ago (around 20 years ago I guess), and that was in C++...

A "toy" add-in showing how to do it in C# can be found here:
https://github.com/nbelyh/SampleVisioDragDropAddin

The related links with information:
https://stackoverflow.com/questions/37492858/visio-vsto-drag-and-drop/37513185
http://visguy.com/vgforum/index.php?topic=10009

The sample above creates shapes from a stock stencil;
If you actually want to create them from a memory stream (from the downloaded data), that will be a bit more complicated, but perfectly possible.

wapperdude

My concern, in general, is security.  However, from a company basis, have a central repository of unique, customized repository for shapes, stencils, and templates seems logical.  Being able to drag N drop would efficiently enhance that capability.

For individual user not so much, eh?
Visio 2019 Pro

Visio Guy

#3
I have a "jammer" tool that I have long thought might be used for distributing smart techniques via text. This fits in with this discussion, to some extent.

The tool parses "cellname-formula pairs", for example:

// Make shape size according to text content:
Width=GUARD(TEXTWIDTH(TheText))
Height=GUARD(TEXTHEIGHT(TheText,Width))

You basically type or paste this text into the jammer editor, then apply it to all selected shapes.

I allow for some wildcards in the formula portion, like {PARENTID} and {SELECTIONINDEX} for getting the group's sheet reference, or incrementing smarts according to the "index" of each selected shape.

As a public add-in, my idea was to easily allow people to publish smart behaviors and techniques via blocks of text in forum posts or blog articles.

I use it all of the time to make sweeping changes quickly, but it doesn't create geometry very well, as I wanted to be able to append geometries, which requires a bunch of relative index management I haven't had time for.

It has an "extract" feature, so you can, say: get all the User-cells and Shape Data from one shape, then blast them into any number of other shapes. Saves lots of time!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nikolay

#4
Quote from: wapperdude on April 14, 2024, 04:36:46 PMMy concern, in general, is security.  However, from a company basis, have a central repository of unique, customized repository for shapes, stencils, and templates seems logical.  Being able to drag N drop would efficiently enhance that capability.

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

I would say there is a need for an internet STORE where you can buy/get shapes (or solutions). Similar to other office applications; but this needs to be set up and maintained by Microsoft itself, to be trusted and out-of-the-box thing.

Any third-party store would require an installation of third-party software/plugins, this is a show-stopper for many.
Not to speak about developers: the cheapest digital signature now is $250 / year, with the introduction of the mandatory USB token.

I was thinking about copy-paste of a shape from a web page; with new "web" formats that could be even possible; but Visio still does not support that :(
https://developer.chrome.com/blog/web-custom-formats-for-the-async-clipboard-api. That is, the custom web formats and copy-paste could work without any third-party installs.

Thomas Winkel

thanks for all the Feedback :D

Quote from: Nikolay on April 14, 2024, 03:12:35 PMIf you actually want to create them from a memory stream (from the downloaded data), that will be a bit more complicated, but perfectly possible.

Great 8)
Drag & Drop from local stencils is not the problem.
But how to do that from a DB on a remote server?
During my research I came across your article that could provide an approach:
https://unmanagedvisio.com/persisting-visio-shapes/
This way I could store the shapes directly in the database instead storing the stencils in the file-system.
Then I could (not proved that) in the drag event:
* Get the ID of the dragged image
* Get the shape data from the server by ID
* Convert the data to DataObject
* DoDragDrop(data, DragDropEffects.Copy);

My first experiment with your code was only partly successful because the the dropped shape lost formats (color).
Also I tried what happens if properties in document shapesheet are linked.
With regular copy & paste this is no problem. But with this method this information was lost.
I also tried to to serialize the shape object with Newtonsoft JSON, but that`s not possible.

Quote from: wapperdude on April 14, 2024, 04:36:46 PMMy concern, in general, is security. 
The user must trust my AddIn, but if I only allow shapes or stencils without macros that should be secure?
Agree with Nikolay, that MS should integrate such a feature in Visio and also should provide the infrastructure.

Surrogate

Quote from: Thomas Winkel on April 14, 2024, 08:16:06 PMMS should integrate such a feature in Visio and also should provide the infrastructure.
I'm not sure it's going to be profitable for them!

Nikolay

#7
@Surrogate IMHO that does not matter. If you support an application, you support it; otherwise you don't.
It's been 10 years already since the App store has been added to the other office applications.

@Thomas - my assumption is that the issue with the color may be related to themes somehow. Maybe you should save not "Shapes" but "Shapes Xml" (or whatever there is) somehow (there are multiple variations of the data stream you can get from a shape). I.e. does the problem with the color happen if you copy/paste on the same diagram? If not, then it's diagram settings probably. Like, in the shape serialized you have a refernece to theme like "THEMECOLOR()" and then ween deserizalized, that resolves to the color of the current theme and not to the one that was serialized.

Thomas Winkel

Quote from: Visio Guy on April 14, 2024, 04:38:04 PMI have a "jammer" tool that I have long thought might be used for distributing smart techniques via text. This fits in with this discussion, to some extent.
That definitely sounds interesting to quick and easy modify existing shapes.
Here I would like to create an quick & easy way to search & insert shapes from the community without the need to download and open a stencil before.
Maybe such a community shape server could be hosted here next to the forum.
Every Visguy user would be able to contribute, either by uploading stencils, or by drag & drop from the page into the addin.
The usability is important. If it's not quick & easy nobody will use it.

@Nikolay:
Thanks for your input.
It was a simple rectangle on the same diagram.
I will check that again later this week and create a minimal example.

Thomas Winkel

Ok, here is the minimal example for my experiments with Nikolays "Persisting Shapes" approach:
https://github.com/ThomasWinkel/VisioAddinPersistingShapes
There are three buttons and one drop down in the ribbon:
* Get Formats: Fills the drop down with available DataObject Formats of a selected shape
* Save to Clipboard: Exports the chosen DataObject format of the selected shape as text to the clipboard
* Load from Clipboard: Restores the shape from text in the clipboard
No idea what happened before, but now it works like a charm.
Very cool to see how complex shapes can be restored from a few kB of text 8)
One available format is "DeviceIndependentBitmap".
Next step is to transmit both, the shape and the bitmap to the server on Drag&Drop from Visio to the WebView2 control.

Surrogate

Hi, Thomas!
Quote from: Thomas Winkel on April 15, 2024, 04:00:18 PMMaybe such a community shape server could be hosted here next to the forum.
Every Visguy user would be able to contribute, either by uploading stencils
Not sure that forum's engine (Simple Machines) support this opportunity!
Quote from: Thomas Winkel on April 17, 2024, 07:25:09 AMOk, here is the minimal example for my experiments with Nikolays "Persisting Shapes" approach:
https://github.com/ThomasWinkel/VisioAddinPersistingShapes
How we can install it?

Thomas Winkel

Quote from: Surrogate on April 17, 2024, 08:51:09 AMHow we can install it?
Clone (or download) the repository.
Open in Visual Studio.
Hit play button.
See AddIn part in video above, it's the same procedure.

Quote from: Surrogate on April 17, 2024, 08:51:09 AMNot sure that forum's engine (Simple Machines) support this opportunity!
No need for direct support from SMF.
I would only link to SMFs user authorization to grant access.
So you could manage your shapes and I can filter for shapes that were contributed by user Surrogate.
Of course that requires custom code.

Thomas Winkel

#12
Time for a video update:

* Shape is fetched from the server in JavaScript on 'mousedown' event
* No preview on drag (local drag shows a preview next to the mouse pointer)
* Does not work if I enter the Visio Window too fast (how will this behave on remote servers?)
* For the moment I added the shapeObject strings by hand to the db
  * Did not find a way to do this in watchUploads.py (any ideas?)
* Next step: Add shapes to DB by drag & drop (will replace watchUploads.py)
* Repository updated

Surrogate

Quote from: Thomas Winkel on April 17, 2024, 09:41:21 AMSo you could manage your shapes and I can filter for shapes that were contributed by user Surrogate.
I can offer this stencil
https://surrogate-tm.gitbook.io/my-stencils/racks/stencil-for-create-rack-diagram
Most of my stencils are not interesting outside of the ex-USSR...

Surrogate

#14
Quote from: Thomas Winkel on April 17, 2024, 09:41:21 AMSee AddIn part in video above
I try reproduce all step by step like as your video! But I get error after press button Start for compile AddIn.
https://youtu.be/0KASmwGkDRU?t=492

Dont find all these components...

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: 497 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1325KB.
Tokens: post-login.
Cache hits: 13: 0.00202s for 26,767 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]