Inserting a shape, but offset from another shape

Started by gajtguy, June 17, 2012, 09:41:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gajtguy

Lets begin the noob questions..   

Say I want to create a shape of a lock on a door.  I can draw it however I like, as there are many type of locks out there. Then I want to save it as a shape and have it automatically 'store' how high up and how far over from the bottom of the door it is. I say bottom of door, but the point could be any other spot on the door. The point is to be consistent with how easy it should be to place a lock on a door moving forward.

So how do I create/save a "lock" shape that will consistently be inserted on the "door" shape at the same spot each time?

Thanks
Don't throw everything away. There is NO away!

vojo

Others are more knowledgable on this front, but I believe you will have to use the setatref functions in the shapesheet for pinx and piny.

This is NOT for the faint of heart.

Assuming you get this functions right....I believe the the process would be
- drag a door from a stencil (yours or somebody elses stencil) that has a reference point icon
- drag the lock from a stencil (yours probably) and bring to door reference point.....then release mouse button....it would snap to location relative to reference point.

I believe the tough part is that door shape is not defined when lock in the stencil....so not sure you can use  the loctoloc, loctopar, partoloc functions in the shape sheet.

The key problem is that visio shapes are NOT self aware (without writing VBA).....so you cant place 2 unrelated shapes on the page and have them find each other.
(of course, if you want to write some VBA....the world is your oyster ;-)  )

Of course, the far simpler approach is to make a shape that consists of the door and lock.   Place the lock where you want on the door.
May end up with a stencil of 20 doors with locks....aka a shape farm....user chooses the one he wants.
The DOWNSIDE to this is shape mgmt in that if you decide you need to change the lock location by 1mm....need to do it to 20 shapes manually.
I use this approach exclusively....most if not all well known stencils you will find tend to use this approach. 
If you are new to VISIO....I would strongly recommend this approach first.....after playing with it for a year or 2, then try something slick like the first idea.

Others may have more insight into this kind of thing.

Jumpy

Another thing you could try, is to make a lock-shape, that is a composition of all the locks you need. Create that as a so called smart-shape or multi-shape, so you can select via ShapeData what kind of lock it is this time and make it visible while making all other locks invisible.
So you have a lock that can take any form of a lock you  need.

Combine that lock-shape with your door shape (or all door shapes, if you've more of them) and give that "combined"-door-shape a similiar ShapeData to choose the kind of look for that door.

For this you need to learn about the ShapeSheet, but no VBA.

hth Jumpy

JohnGoldsmith

Just to add to Vojo and Jumpy's comments - one factor is are the door shapes your's or can you modify the masters?  Also is the position of the lock on the door determined by the door (ie are they pre-drilled for example) or by the lock (ie 'lock x should always be mounted at 60% of the height')?

If the doors have specific mounting points then you might want to add connection points to the doors and allow the locks to be glued to those points.  Alternatively if the lock positions are relative to the door height then you might want to make the overall lock shape the size of the door and just have the visible lock geometry positioned within that outer rectangle (the alignment box). 

There are a number of ways around this and it will depend on your particular requirements, but my approach is to try and emulate the real-world functionality and data as closely as possible (within reason) as I find that solutions built in this way are easier to maintain in the future.

Hope that helps.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

gajtguy

Thanks guys. I will look in to the smart shape idea. But I feel this problem is the basis of a much larger issue as I need to drop many items on a door or around a door. And I don't think it would be practical to setup one smart shape with all of the various items I could potentially have. But I will experiment with smart shape idea a bit.

In the past I have made specific combos of items and saved them as individual solutions/shapes/symbols. But that does indeed get in to long term maintenance nightmares.

Related to the masters, I will make my own masters. Probably five or six times, until I get this program figured out.  I feel like this program can be made to work the way I'm accustomed to. But it might come down to same situation that happens repeatedly on the Dog Whisperer. And that is, he never fixes the dog, he always retrains the people.  lol
Don't throw everything away. There is NO away!

gajtguy

I just made my first smart shape. The segmented LED clock tutorial from many years ago.  It was pretty cool to do. I wish there were more tutorials out there, for the 2010 version.

The power in those shape sheets is pretty amazing. As usual with Microsoft products, it's a bit confusing starting out and knowing what is available through various formulas or VBA. 

But so far this is pretty fun stuff!!
Don't throw everything away. There is NO away!

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: 230 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1120KB.
Tokens: post-login.
Cache hits: 13: 0.00116s for 26,587 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]