How to know for which Master a Visio shape belongs to - visio

I am having difficulty in finding out the master shape for a Visio shape.
Suppose if I drag a Shape named 'Start Shape' from a Stencil to a document then Visio will create an instance for shape 'Start Shape' on the Document.
Now I can access the shape name using Name/NameU of the shape property, but using Name property I got name as 'Start Shape.12'
I need to find out the master shape name i.e 'Start Shape' from which the dropped shape is created. In the above case 'Start Shape'

Note that when you drop a master (shape) from a stencil, Visio creates a local copy of that master in the drawing (you could make those visible using the "Drawing Explorer" window). So when you refer to shape.Master you actually get a reference to that copy.
That means, if later you change the master shape in the stencil, and drop it one more time, you may get another local master (again with suffix). This also means that if you rename a master in a stencil, your local master (and thus Shape.Master.Name) will stay unchanged.
To get an "exact" source (if you need to) you may take a look at the "BaseID" and "UniqueID" properties of a master which may be helpful to figure out what was the original master in case it was modified.

I solved the problem,
through Shape.Master.Name property we get the Master Shape Name.

Related

Visio - How to use the same shape property for many shapes

I have created one master shape with many properties. In the "Define Shape Data" windows of the master shape (of the document stencil), one of the properties (masterProp) is a variable list (so with a list of allowed values).
Is it possible to re-use the list of values allowed for this property (masterProp) to define the format of another property of type variable list in another master shape so that the list of values has to be maintained only once ?
Maybee is there a way to set up "lists" in Visio and link the expected/allowed values (format field) of a property to this list (without using excel) ?
Thanks for your advises,
Is it possible to use the same property (masterProp) in another master
shape to inherit the same allowed values? Or is it possible to link
the values of another property of type fixed list in another master
shape to the values of this masterProp property ?
You mean mastershape in document stencil or in external stencil ?
You can refer to some cell of mastershape in document stencil
To reference a cell of
Use this syntax
Example
A master
Masters[MasterName]!SheetName!CellReference
Masters[Gear]!Shaft!Geometry1.X1
About Cell References
Well, Thanks to #Surrodate, this is the correct way of doing this:
Add a user-defined cell in the ShapeSheet of the document (or the page)
Open the master shape for editing
In the master shape, open the shapesheet of the master shape and go to the section of the Shape Data
In the Format column, refer to your user-defined cell. Begin typing with a "=" otherwise it takes your entry as text (even if it recognise your data ...). To refer to the document, begin with =TheDoc!User... if your data are in the page, begin with ThePage!User... Do not forget to set the type of data to 1 or 4 (in case of list).
Ok, I found the shapeSheet of the Page-1. I added a user-defined
section, then a cell named "User.Softwares". I set the value to
="Soft1;Soft2;Soft3". Correct for list ? Then in the field "Format" of the "Define Shape Data" windows in have written
"Page-1!User.Softwares". Is that the correct way to refer to the
page-1 ? When I click on the property of a shape, it proposes the text
"Page-1!User.Softwares" and not the value of the user-defined cell in
Page-1 ... What is the mistake ?
You must also change Type field ! If in this cell stores 0, it mean "String". if cell value is 1 it mean Fixed list.
You must write Page-1!User.Softwares, without quotation marks !

Changing node icon to "folder" when adding child in fancyTree

It seems to me that the standard behaviour in fancyTree, when adding child nodes is NOT to change the parent node to have a folder icon.
For example, see http://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html and try adding a child node.
How is it possible to dynamically change the icon of the parent to a "folder" when adding a child?
I thought that I could apply renderTitle() to the parent node, but this did not do anything.
This question Dynamically change icon in fancy tree is similar, but (a) I could not get it to work, and also (b) I wanted a solution that didn't involve having to create new icons.
Folders may be empty, so this status is defined by node.folder = true (not by the fact that children are present or not).
So you could set node.folder and call node.render().
Note that setting an additional class may give the same effect, but may get lost when the tree is updated.
In jquery.fancytree.edit.js I added the following line
newNode.parent.addClass("fancytree-ico-ef");
The code snippet is as follows:
newNode.makeVisible(/*{noAnimation: true}*/).done(function(){
$(newNode[tree.statusClassPropName]).addClass("fancytree-edit-new");
self.tree.ext.edit.relatedNode = self;
newNode.parent.addClass("fancytree-ico-ef");
newNode.editStart();
});

Remove leafs from phytree if all the branches have same value

I'm using MATLAB to generate 'phytrees' and I need to simplify them.
The way I thought is by removing subtrees where all the node has the same value and keep only this value + a number that represent how many nodes were deleted.
For example, here is one of the trees:
and I want to replace the subtrees that have the same values like here:
Is there a way to do so?
I did not find a programmatic way to do it, but from the picture you attached I see that you use plot to view your figure. If instead, you'll use the phytreeviewer (just type view(your_phylotree)) you'll get a different figure window, with other related tools.
Specifically, you'll see the Collapse branch button , and the Rename branch button , which will together get you exactly what you want. The first "removing subtrees" (actually hiding them), and the second lets you change the branch name to "value + a number".
You can do all this also by simply right-clicking in the relevant brunch:
Here is an example with data from the docs:
% bulding some tree:
seqs = fastaread('pf00002.fa');
distances = seqpdist(seqs,'method','jukes-cantor','indels','pair');
phylotree = seqneighjoin(distances,'equivar',seqs);
view(phylotree)
After some collapsing and renaming on this tree, and printing it to a figure (with right click on the most top branch, or the root, that you want to include in the figure), I got:
Also, note that every time you hover with the mouse on a branch (even if collapsed) you get a list of the Leafs in that branch and their count:

Alternative to simulink transparent subsystem

I need to organize a set of elements in simulink. The first method is to create a subsystem. The problem with subsystem is that the elements inside it are no longer visible. An alternative method is to create a colorized box and put it behind a set of elements as a background. It makes a lot of troubles during selection of elements.
The ideal method is to have a subsystem which is transparent but you can see the elements inside it. So you can make it large and see inside it without opening it.
What is the feasible alternative method?
Knowing that there is no support by simulink doing this, the only possibility would be to use a mask icon which shows the content. The following is a very rough prototype for the mask code:
model='s1/Subsystem';
loc=fullfile(pwd,[model,'.png']);
print(['-s' model], ['-dpng'], '-r300', loc);
image(loc);
port_label('input',1,'In1');
port_label('output',1,'Out1');
Obviously this prototype has multiple issues which must be addressed when really using the code:
Remove the hard-coded directory.
Set in- and outports automatically.
create required folder structure. (folder s1 must be created once manually)
Scale the subsystem block to make the image look good
work properly if pwd is not the directory the model is stored in
You can make use of the 'Icon Drawing Commands' of the mask parameter's tab 'Icon and Ports' :-
Take a screenshot of the logic gates you want to be visible on the subsystem (the ones with a blue background color shown in your question)
Save the picture e.g 'mylogic.png'
Write this command in the 'Icon Drawing Command' field of Icon and Ports image(imread('Pause_Icon.png'));
You're done. But yes, make sure you have the picture file in the same folder as your model or simply add the folder containing the picture on your path.
Of course, if you update the blocks inside the subsystem, you'll have to update the mask icon with the new screenshot.

Visio Master shape being overwritten when added to the page

I have created a visio master shape that shows fields from the shape property (Name, Title, Department, type). I add all the fields to be displayed on the shape and it looks fine on the master shape, but once I add the shape to the page, it only shows the first two fields (name, title). It seems to be reverting back to a default I can't get rid of, is there anything on the shape sheet that I can edit to remove this? Any help would be greatly appreciated.
Anag
Uncheck the "Match master name on drop" option in the master's properties.
When checked, it forces the behavior you describe (reuses old master if exists)