Author Topic: Building a Triangle Shape  (Read 24580 times)

0 Members and 1 Guest are viewing this topic.

david

  • Full Member
  • ***
  • Posts: 101
Building a Triangle Shape
« on: July 19, 2008, 04:37:20 PM »
i built a triagle master (by three simple lines and 3 control points for each vertex to allow the user to make whichever triangle he wants).  i also added 6 custom properties for the coordinates of the triangle (x coordinate and y coordinate for each vertex).  my problem is that i didn't succeed making the right formulas for changing the coordinates through the custom properties.  i did succeed after many formulas to do it vise-versa (moving the triangle updates the coordinates in the custom properties to the right values) and even then it works only if i don't rotate the triangle.  somehow i'm sure that i'm working hard for nothing.  isn't there a simple way to build a triangle by its vertexes and not by its width, height and angle?

thanks in advance
David
« Last Edit: July 20, 2008, 04:02:14 AM by Visio Guy »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3822
  • Ideas Visio-lized into solutions
Re: Building a Triangle Shape
« Reply #1 on: July 19, 2008, 07:35:48 PM »
You may use the Geometry section of the shape sheet to specify the X-, Y- coordinates relative to each other.  The Geometry Section locates one point at (0,0), and all the others are placed relative to that point, regardless of rotation.  So, you have to do some math to do a coordinate translation mapping.  The math may be done in the User-defined Cell Section, which you will have to add if you haven't already done so.  The angle in the Shape Transform Section controls the overall orientation of the rectangle.  Note, the Size and Position Window also gives the user direct access to this angle along with the width and height of the shape.  The pencil tool may be used to grab individual vertex and move it around.

Hope this gets you headed in the right (useful?) direction.
Wapperdude
« Last Edit: July 20, 2008, 04:02:24 AM by Visio Guy »
Visio 2019 Pro

vojo

  • Hero Member
  • *****
  • Posts: 1515
Re: Building a Triangle Shape
« Reply #2 on: July 19, 2008, 09:27:51 PM »
You can look at these for what they are worth....have others (octagon, hexagon, etc) if you are interest
Can set by custom properties or by dragging....right click shape.
« Last Edit: July 20, 2008, 04:02:33 AM by Visio Guy »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3822
  • Ideas Visio-lized into solutions
Re: Building a Triangle Shape
« Reply #3 on: July 19, 2008, 10:20:18 PM »
David, I tried to re-create your steps, and here's what I found to work.
1.)  Draw your default triangle.
2.)  Create your shape data entries.  For simplicity, I made the "names" X1, Y1, X2 ... etc.  Six entries.  I added 3 more entries, the lengths of each side.  For convenience, make the values that you enter identical to your drawn shape.  Also, you might want to check the box:  ask on drop.
3.)  Open the shape sheet:
       Shape Transform:
       Use the max fcn for both width and height.  Width will be the greater of X2-X1 and X3-X1.  Likewise for height.  You may want to guard these fcns.  Don't forget the Prop prefix.

       Geometry1 Section
       Set the 1st X & Y entries to Prop.X1 and Prop.Y1.  Likewise for the next two vertices.  The last will remain unchanged as it closes the shape back to the 1st point.  You may want to guard these entries too.  I didn't try this though.

       Shape Data Section
       Enter formulas for the three line length rows in the value cells.  For exmaple:  L1= SQRT((Prop.X2-Prop.X1)^2+(Prop.Y2-Prop.Y1)^2)

Your triangle should maintain it's shape for any angular rotation.  When you bring the Shape Data table back up, the lengths will be updated.  This ought to meet your basic requirements.

« Last Edit: July 20, 2008, 04:02:43 AM by Visio Guy »
Visio 2019 Pro

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Building a Triangle Shape
« Reply #4 on: July 20, 2008, 04:02:03 AM »
Try the stencil:

File > Shapes > Visio Extras > Drawing Tool Shapes
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

  • Full Member
  • ***
  • Posts: 101
Re: Building a Triangle Shape
« Reply #5 on: July 21, 2008, 12:35:01 AM »
thanks for your answers
i already looked at that stencil and you can update the triangle there by its pinx, piny, width and height.  and not by its six coordinates like i wanted.

btw, i looked at the triangle shapesheet and i don't understand where are all the formulas that update the size/position of the triangle on the frame after the user changed the details on the size/pos properties?

wapperdude, thanks for your steps but it still didn't work for me.  i sent you a personal message.

thanks
David

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3822
  • Ideas Visio-lized into solutions
Re: Building a Triangle Shape
« Reply #6 on: July 21, 2008, 01:20:31 PM »
Hi David --

This is a follow-up reply to your email.  I can attach the file here, in case anyone wants to look at it and make suggestions and recommendations.
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3822
  • Ideas Visio-lized into solutions
Re: Building a Triangle Shape
« Reply #7 on: July 21, 2008, 08:37:57 PM »
The better triangle:  properly stretches/shrinks,rotates,modifiable with pencil tool, takes user input.
Visio 2019 Pro