Hidden Stencil or hidden shapes in stencil

Started by Michelle, January 18, 2013, 07:52:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michelle

Never one to be content, I started thinking of a better way to deal with my shapes.  I can see the scope of my project growing immensely down the road, and where I currently have a handful of shapes that need to be automatically (programatically) placed in the drawing, I may have a hundred or more soon.  I don't think having a hidden page in my file to "hold" these shapes is the best way to go or my file will be HUGE.  I would like to bring them in and place them from a stencil.

But I don't want these "automatic" shapes to be used by the end user (except once they are placed in the drawing), so I'd rather those shapes were hidden.  Can I hide shapes in a stencil? And then have them place on the drawing in a visible form with a CALLTHIS?  Or can I have a stencil full of these shapes where the entire stencil is hidden? 

I am toying with using the Document Stencil for this, but I would love to get in there and "clean house" as there is MUCH in there that should go... can I unlock the document stencil?  I want to be able to add, delete & modify shapes in the documant stencil.  I am confused about the document stencil... It has all the shapes in the drawing, correct?  So if a shape is in the document stencil, it is also somewhere in the drawing... and if I delete the shape, it dissapears from the document stencil?  I created a master in another stencil, and named it "zzzzz" to make it easy to find in the document stencil, but it showed up in the document stencil as a completely different name.  (The master was created by copy/paste, so the name must have come from the original... but that is too confusing!)

Also, Wmy project is to create a Template that users will copy to their hard drive from a server whenever they do an update.  Will I need to adjust my code to deal with this?  It looked like the code in my Macro (when I was trying out placing a master) pointed to the location on my computer where my stencils are... but this folder structure will be different for everyone else.  How can I make sure the code will work for other users too??  Can I use * like in a windows search?

Thanks again!!!
Michelle

Jumpy

Using the document stencil has the same drawback as using a hidden page: If you have many shapes, each document will become huge.
So you should use a normal stencil and distribute it together with the template, that you create.
But you can't hide a stencil or make it invisible I think but maybe I'm mistaken.
But you can open and close a stencil with VBA whenever you need it. So you open the stencil, drop the shape and close the stencil again.

Michelle

Never thought of just opening & closing it programmatically... I will have to try that.  I worry though about the fact that the end user may have a different folder structure than me, and I'll be creating a Macro based on my system (the folders I keep stencils in, etc)...
I will play around with it, though...

I found this, and wondered if anyone ever tried it: Visio.ActiveDocument.Masters("MyMaster").Hidden = TrueSupposedly you can set this and it makes a shape in the stencil invisible?  But I don't know if the shape "appears" when placed on the page.  I will have to look into this too.

Also, if the document stencil is making my file larger, I need to clear it out.  There is a ton of stuff in there from my many attempts at different solutions... How can I get rid of the shapes in there?  I would just swear that many of them don't exist anywhere but in there! 

Michelle

aledlund


Yacine

Best would be to implement a stencil that you would close after use, as Jumpy said.
That would make maintenance work easier (e.g. updating the stencils in one quick run)
The issue with the different directory structures of your users can be handled by means of setup data that you can save in different places (document or page custom data, relative paths instead of absolute, separate file, ...).
You would keep your users documents clean and get a more robust solution.
Yacine

AndyW

You could open the stencil using the OpenEx function and pass in the flag visOpenHidden, you then have your stencil opened but not visible to the user. I do this to hold the shapes I programatically drop on to the diagram
Live life with an open mind

stugol

1. The best way is to use a stencil.
2. You could work with your shapes in a stencil in a normal way, but you would have to programmatically hide them using Master.Hidden = True. I'm not sure you can do that using the interface, but I'm sure you can do it using codes.
3. If you hide all your masters in a stencil, the stencil will appear empty, but neither you nor users can see it, so you would have to use the drawing/master explorer where even hidden masters are shown. In such a case, even though you have hide your masters, you can still select them and work on them the usual way. The bad thing is that the user can do the same, but I would venture that most users will not know about the master explorer.
4. When a master is dropped on a page, the master gets copied to document stencil and stays there. It does not get deleted, until you do the "Reduce File Size", otherwise irrespective of whether it is used, it stills stay there.