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.

Nikolay

I'm using community. Works fine for Visio addins.

Thomas Winkel

Many thanks for investing your time, Nikolay!
It would definitely have taken me a long time to find this error.

@Yacine
I use the community edition and this is absolutely sufficient for everything that I do.
At work I have the professional version for writing EPLAN AddIns and honestly I don't see any differences.

Paul Herber

I originally used the community version for writing my Utilities. Did all that was needed for me.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Surrogate

Quote from: Yacine on April 27, 2024, 07:13:21 PMDid you guys get the pro version, or are you working with the free community one?
I use Community edition.
Quote from: Thomas Winkel on April 25, 2024, 11:56:37 AMOk, next try
I didn't try it yet  >:(

Thomas Winkel

Finally working :D
https://github.com/Visio-Resources/VisioOnlineShapesLibrary/releases/tag/v0.1.4

No new Features, but a confirmation that the installer works.
And the first beautiful shape from the community has been committed... ( thanks, Rolf!  :-*  )

From now on I will always link the current version in the opening post.
As well as some News, TODOs, Comments.

Surrogate

Quote from: Surrogate on April 27, 2024, 08:48:44 PMI didn't try it yet
For versions 0.1.0 and 0.1.3 I didnt have button 'Online Shapes' at ribbon
Quote from: Thomas Winkel on April 29, 2024, 05:29:44 PMFinally working :D
https://github.com/Visio-Resources/VisioOnlineShapesLibrary/releases/tag/v0.1.4
Thank you, Thomas!
I try tested latest VisioOnlineShapesLibrary_0.1.6.msi version. I can see  button 'Online Shapes' at ribbon.

I upload two shapes. But cant upload whole stencil  :o

In pane I cant see online shapes from your site (www.visio-shapes.com)
 

Thomas Winkel

Thanks for testing, it works :D

Contributing stencils from Visio is not yet implemented.
First I work on user management because this affects the data model.
This may take a while because I have little time right now.

Now you can only drag shapes to your drawing and the download counter will increment.
A click on a shape will open a bigger preview in your default browser.

Thomas Winkel

#52
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.)

Thomas Winkel

#53
I just want to give an update on current developments:
* Redesign of the Flask backend following this guide
* Added user model -> each shape / stencil now has an owner
* Added models for teams, user-roles, downloads for future use (visibility, administration, rating)
* HTML generation on the client side using web-components enables responsive filtering and sorting
* Stencil contribution now functional
* DataObject stored as Dictionary<string format, string data> (-> display correct bounding box on drop)

Fun fact:
After I "contributed" a stencil for some of the shapes only a single segment was placed on drop because I only stored Master.Shapes[1].
This works as long as the shape was grouped before added to a stencil (or it was a single shape).
But in case a selection was added to the stencil the master has more than one shape.
In that case now I create a group before I create the DataObject.
Visio also creates a group on drop of such a master, so for the user there seems to be no difference.

Brainstorming:
Shapes that are dropped from this library do not have a master.
I think it could be better (in terms of maintainability, speed, file size) to:
* On first drop: create a master in the document stencil and drop the shape from there
* On future drops: drop the shape from the document stencil instead from my library
But then I would need to compare each time if something changed and in that case create another master.
(Also Visio does so...)
Maybe it would be better to directly store a DataObject of the master (instead of the shape)...
What do you think...?

Btw.
For the moment I will only commit the code.
Server and AddIn will be updated after the interfaces are stable enough.


Thomas Winkel

I tried to store the DataObject of the master instead of the shape:
DataObject dataObject = new DataObject(master);
Dictionary<string, string> dictDataObject = new Dictionary<string, string>();

foreach (string format in dataObject.GetFormats(false))
{
    MemoryStream streamData = (MemoryStream)dataObject.GetData(format);
    if (streamData is null) continue;
    dictDataObject[format] = Convert.ToBase64String(streamData.ToArray());
}

That works. The DataObject contains the following formats:
+ Visio 15.0 Masters
- Visio 11.0 Masters
- Embed Source
+ Object Descriptor
- NoteshNote
- EnhancedMetafile
- MetaFilePict
+ DeviceIndependentBitmap
(- means the data is null and thus not stored)

But DoDragDrop does not work:
Dictionary<string, string> dictDataObject = JsonConvert.DeserializeObject<Dictionary<string, string>>(shapeData);
DataObject dataObject = new DataObject();

foreach (var format in dictDataObject.Keys)
{
    MemoryStream streamData = new MemoryStream(Convert.FromBase64String(dictDataObject[format]));
    dataObject.SetData(format, streamData);
}

onlineStencilsForm.DoDragDrop(dataObject, DragDropEffects.Copy);
Rebuilding the DataObject from the Dictionary works.
And I see the correct bounding-box at my mouse pointer.
But there is also a "forbridden" symbol:
You cannot view this attachment.

Just for testing I replaced the DoDragDrop method above with Nikolays demo code from stackoverflow.
That works...

Any idea?


Btw.
I compared document size after 12 x placing the same shape from:
* Online Library -> 785kB
* Local Stencil: -> 121kB
This is worse than expected.  :-\

Thomas Winkel

Sometimes it just helps to write everything down  :)
Place that after the foreach loop and it works:
dataObject.SetData("Visio 11.0 Masters", null);
dataObject.SetData("Embed Source", null);
dataObject.SetData("NoteshNote", null);
dataObject.SetData("MetaFilePict", null);
dataObject.SetData("Visio 11.0 Masters", null);

New comparsion:
* Online Library (Shape) -> 785kB
* Local Stencil: -> 121kB
* Online Library (Master) -> 104kB
I don't know why it's smaller than from local stencil, but I don't care ;D

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: 401 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1251KB.
Tokens: post-login.
Cache hits: 14: 0.00259s for 26,724 bytes (show)
Cache misses: 4: (show)
Queries used: 18.

[Show Queries]