Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: jamtart on December 17, 2008, 06:40:48 PM

Title: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 17, 2008, 06:40:48 PM
I need to find a way to have two triangles in a composite drawing add together so that a third triangle is the result of the first two triangles. In my attached example the green and gray triangles must be added together to get a resultant triangle (blue). Hope someone can help me out with this one.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 17, 2008, 09:24:03 PM
This can be done with formulas, once the relationship between the triangles is determined.  It looks like the areas of the green and gray triangles are added to get area of resultant triangle.  Only problem, the short side of the blue triangle looks to be in error, s/b 35.41?

The necessary formulas can be entered into the shapesheet of the blue triangle, which references the geometry of the green and gray triangles.  But, before that can be done, still need to know what the relationship is between the 3 triangles.  If you have an equation or formula, it's relatively easy to add it the shapesheets.  Then, as you change either or both green/gray triangles, the blue will adjust accordingly.

Wapperdude
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 18, 2008, 01:08:22 AM
At the moment the Blue triangle is not correct, i knew that. the blue triangle is all the Watts of the green and grey added together and the Vars of the blue are the Vars of the green minus the vars of the grey. the hyponenous  is pathagareum therum of the resultant watts and vars. The angle of course should just follow along. I will have to give this a try tomorrow at work.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: vojo on December 18, 2008, 03:33:37 PM
Be careful...this is going to get far more complicated than you think, assuming you want the new triangle to be the sum of the areas of the old triangle.   You are going to have to add the individual areas to get new area then work back to get base height then translate (assuming isosoles (sp) or right triangles) to get the 3 lines of the new make it all work out.  Moreover, since two variables (base and height) I think you will have to make some assumption on their relationship (base = 2* height or something like that).

Definitely sounds like a VBA macro
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 18, 2008, 03:36:31 PM
Been banging my head against the wall on this one. Realized that just from the way I have the diagrams laid out that I dont need to worry about the horizontal calculations, just the vertical one. ShapeSheets are not my forte :-[
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 18, 2008, 05:07:44 PM
To do this simply, (avoiding most math), here are the assumptions: 
1.)  Drawing is always as you've shown
2.)  Green triangle can only go negative or to zero
3.)  Gray triangle can only go positive or to zero
4.)  The blue height is just the sum of the other two.

For simplicity, I'm assuming that the only shapes on the page are the three triangles.  For even greater simplicity, assume that they were drawn in this order:  green, gray, blue:  that way, green will be shapesheet 1, gray #2, and blue #3.  (If not, then, you need to go to View > Drawing Explorer > Foreground pages>shapes.  Click a shape and it will be selected, and that tells you its shapesheet id.)

Open the blue triangle shapesheet.  In the 1st section, Shape Transform, make the following entries:

1.)  LocPinY => Height*1.  Note, this will shift the triangle in the drawing, just re-position it to where it needs to be.

2.)  Height => guard(sheet.1!height-sheet.2!height)

That's it.  Close the shapesheet.

Now as you drag the green/gray triangle's height, the blue will follow.

Wapperdude
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 18, 2008, 05:21:36 PM
All your assumptions are correct wapperdude. Triangle green one seems to be called "Rt. triangle: 2 legs" the gray one "Rt. triangle: 2 legs.2" and the last one (blue) is "Rt. triangle: 2 legs.3" It appears that I may be able to rename these guys here too but I will save that for a later time.
Gonna give what you said a try here and get back to you.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 18, 2008, 05:26:37 PM
Should work fine.  You can always use cntl-Z to undo, or worst comes to worst, close without saving and re-open the drawing. 

If you're still stuck, I can provide a drawing file, but, give it a go first.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 18, 2008, 05:34:29 PM
Had to close a few times without saving already :-[
The LocpinY one really seems to mess up the drawing... Will keep plugging away though.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 18, 2008, 05:40:08 PM
Well I got some interesting results doing this, not quite there yet LOL. I will have to put it aside and try again later... ::)
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 18, 2008, 05:44:31 PM
OK.  I'm going to be on/off, so, here's a solution.  Open when/if you need to.  It also takes care of the widths.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 19, 2008, 04:10:42 PM
No matter what I do I just am not getting what I need, close though... :-[
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 19, 2008, 04:44:39 PM
Perhaps it's time to look at the file I sent.  Most likely, it's something subtle.  If all else fails, attach your file.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 19, 2008, 05:20:36 PM
I left the file that I was working on at work but I have the orginal here, already posted. Your example is so close to what I need to do. The vertical works great but the horizontal is not quite right. For example when I expand the brown triangle to the left the blue triangle expands to the right. I am sure that the horizontal value of the blue is the combination of the other two, but the blue left point must stay put with the brown left point. Hopefully that makes sense. I need numerical values eventually too. FYI, I am hoping to use this as a teaching tool/illustration for my students. And the creation of this is a learning tool for me, lol.
Thank you for what you have attention on this project of mine.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: vojo on December 19, 2008, 08:19:07 PM
pretty solution specific....base of triangles have to be the same...triangles have to be the same type...etc

for you app...maybe fine to cut all these corners...but not for general use.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 19, 2008, 10:13:10 PM
Ah.  For the horizontal expansion, you need to grab the edge of the selection box that is coincident with the triangle's opposite edge (vertical leg).  If you grab the edge of the selection box that is coincident with the left vertex, then the behavior will be weird as you've observed.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 19, 2008, 10:47:05 PM
Ahh, that works very nice wapperdude. I will see if I can muster the info from the shapesheet of yours and use it in mine. Wish me luck, still a real newbie to shapesheets...
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 19, 2008, 11:12:01 PM
Let me know, I'll walk you thru it if necessary.  If you prefer, you may email me directly, I think it's listed.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 19, 2008, 11:22:00 PM
Aurgh!! This should work. I put =GUARD('Rt. triangle: 2 legs'!Height-'Rt. triangle: 2 legs.2'!Height)in the Height box (no need to put anything in the width box I think) and Height*1 mm in the LocPinY box, it all seems logical but the whole resultant triangle moves up and down as I adjust the vertical components of either of the other two triangles, not just the resultant vertical as desired. I thinks I am very close. Here is a simplified version of what I started. :(
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: wapperdude on December 20, 2008, 01:12:27 AM
Well, I haven't gone thru all of the shapesheets, but, for the blue triangle here's a few things.  First, some background.  Visio shapes are based upon width and height parameters.  Shape coordinates are relative and specified in terms of width and height.  The location on a page is specified by PinX and PinY.  The shape is anchored to these coordinates by LocX and LocY definitions.  Check out Visio Guys Artpage, http://www.visguy.com/visio-art/, and look at the entry for Pin and LocPin Illustration.  There's a zip file that might be of interest.  Next, although this isn't really correct, the Shape Transform section is sort of like the selection box section.  It defines the specific page location/size bounds for the shape.  The Geometry section defines the shape details.

For the blue triangle, which is controlled by the other two triangles, you pass information into the Shape Transform section, but not into the Geometry section.  That's why the blue triangle shifts rather than grows--nothing changes in the geometry section.  Also, you set the height of the blue triangle by a control point, again, negating any reference to the other triangles.

Study my file and the shapesheets.  You can right click the shapesheet to toggle between values and formulas.  Change the shapes and watch which entries change and which don't, and look at the formulas to see why.  Using the control points on the two triangles is fine, just not on the 3rd.  The use of the 1D shape is unnecessary, but, for a teaching tool, it does put things into more of an X-, Y-coordinate definition rather than width, height.  But it does compound your task.  Multiplying the height*1 mm is more of a scaling thing, and unnecessary once you resolve all of your geometry / shape transform issues.

One other note, if you select an entry in the Geometry section, it will be highlighted (usually black square), in the drawing.

HTH
Wapperdude
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: joemako on December 20, 2008, 02:14:11 AM
With the original file you uploaded, for each triangle looking shape (they are not normal triangles, they are 1-D shapes that are drawn from shapesheet calculations), I right clicked and selected "Format" -> "Special" from the menu, and changed the name to Green, Blue, and Gray (I could not figure out how to deal with spaces in a shape name [now I see, a single quote :) ]).

In the shapesheet for the blue triangle, under the section controls, I changed the value for Y in Controls.Row_1 to "=(Green!Controls.Row_1.Y + Gray!Controls.Row_1.Y)" without the quotes.

So that now, -85.95 Vars + 62.05 Vars = -23.90 Vars (in how it was drawn).

I also when ahead and connected the total watts measurement to the triangles.


The next issue is the angle measurement for the blue triangle flipping from inside to outside, when the Vars is positive.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 20, 2008, 02:33:36 AM
This is just perfect, I was wondering how to change the names of the triangles too. Thanks joemako. The angle issue in not a huge deal however since as per the theory of what this project is for, the blue triangle vars should never be positive.
I appreciate everything here guys and will look at the shapesheets to better understand how this was all done.

I right clicked and selected "Format" -> "Special" from the menu, and changed the name to Green, Blue, and Gray
Hmm, I am not seeing how you did that, yet...
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: joemako on December 20, 2008, 02:44:30 AM
jamtart, glad we could help :)

BTW, those were some neat shapes, what collection did they come from?

Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: joemako on December 20, 2008, 02:47:10 AM
sorry, my sentence broke up with my comment on it being a 1-D shape.

right-click a triangle, a menu pops up, select "Format" then "Special", a dialog will popup with a name field that you can change.

BTW, I am working with Visio 2003, 2007 may be different.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: joemako on December 20, 2008, 02:50:27 AM
Quote from Visio Guy:

QuoteDon't worry, your problem is easily solved! And something did change with Visio 2007!

To access the dialog where you can see and edit a shape's name, you use the Special dialog, located under the Format > Special menus.

In Visio 2007, this menu has been hidden unless you are running in Developer Mode. This sounds ominous, but it's just a matter of a simple check box:

Go to Tools > Options. On the Advanced tab, notice the check box up at the top named Run in Developer Mode. Simply check this item and the Special dialog will be accessible!
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 20, 2008, 02:55:36 AM
Ahh, progress...
Thanks for that. I will be sure to use everything I have learned here
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: vojo on December 20, 2008, 11:28:11 PM
Guys...it has been suggested that I somehow attacked this effort and/or some of the authors.

That is and was the farthest thing from my mind.  All I was trying to say is that if this solution is going to be general purpose (used against various types of triangles, various sizes, etc), then some of the math issues need to be addressed.

I am all for people getting creative on solving their specific needs.  And I am the first admit that some solutions are less than optimal (some of mine are, frankly, a bit useless to the wider audience) but serve an important purpose.

So apologies of if my intent was misconstrued.

Happy holidays.
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: jamtart on December 22, 2008, 04:09:31 PM
hey joemako, as for your question regarding where I got the shapes, to be honest all I did was do a search in Visio for Right Triangles and this is one of the items that came up so I had no idea what stencil it belonged to. I am using 2007. It belongs in Visio Extras/Drawing Tool shapes.
Hope that helps...
Title: Re: Making a triangle respond to... Shapesheet question here...
Post by: joemako on December 22, 2008, 04:22:29 PM
Thank you, the triangle is in Visio 2003 as well :)