I am working with MATLAB to start Visio 2010. Then I want to put some different Shapes in a new Document from my own Stencil. But how can I add my own Stencil to the new Visio file and how do I add some Shapes to the new Document?

8 Ansichten (letzte 30 Tage)
At the moment I only can start Visio 2010, I can make a new file, then I can save it. But I can not add the stencil from Matlab. I can add the Stencil to the general stencils in Visio without mablab, but maybe I can add it also from Mablab. I tried it with StencilPaths but it didnt work. Also I want to know how I can add new shapes to the document.
Here my first code:
visio = actxserver('Visio.Application');
%visio.ActiveDocument;
visio.Documents.Add('');
visio.Documents.Item(1).SaveAs([cd '\' 'Filename.vsd'])
I would be glad if someone can help me, or if someone can link me a site where I can find some hints to work from Matlab with Visio.
Cheers Max

Antworten (2)

Tom
Tom am 12 Jan. 2015
Hey Max,
I'm trying to do the same. I see that you wrote this about 2 years ago. Do you have any results yet?
Best regards,
Tom

Luis
Luis am 29 Nov. 2019
You can use the invoke() or get() functions to access the stencil. Here a little example on how to drop a circle shape:
appVisio = actxserver('Visio.Application');
appVisio.Visible =1;
doc = appVisio.Documents.Add("Basic Diagram.vst");
pagObj = doc.Pages.Item(1);
% invoke() and get() produce the same result in this case
% stnObj=invoke(appVisio,'Documents','Basic Shapes.vss');
stnObj=get(appVisio,'Documents','Basic Shapes.vss');
mast_circ = get(stnObj,'Masters','Circle');
pagObj.Drop(mast_circ, 5,5);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by