aligning shapes from top and right

F

faraz

I want have two shapes of different sizes i want to make the one shape
boundary touch with other shape boundary ..
for example. shape1 and shape2 is of different sizes rectangle. i want
to place top right corner shape2 on the top right corner of shape1 so
that they are align from top and right.


pinX and pinY gives the center position of the shape, theres no way to
i can align shapes from top or bottom or left or right from pinX and
pinY

help its really urgent !
 
F

faraz

yes i made up some formula of calculating the top,bottom ,left and
right position of the shape..... but the problem im having is when i
place the shape2 by its PinX and PinY, shape2 is aligned ... but if the
size is bigger, it doesnt align from top,bottom,right or left. Instead
both shapes' center are same.

below is the formula i used to calculate top, bottom, left and right
postition of the shape.
pinX=width/2+X
X=pinX-width/2

pinY=height/2 +Y
Y=pinY-heigth/2

left=X
right=width+X

top=hieght+Y
bottom= Y



how would i make sure that it works on shape of any size.???
 
J

JuneTheSecond

If there are 2 shapes, shape1 and shape2.
PinX of shape1 may be called P1X.
PinX of shape2 may be called P2X
Width of shape1 may be called W1.
Width of shape2 may be called W2.

Foe example, if you wish to lay out 2 shapes
where the left side of the shape is vertically alighned.
Then P2X = P1X -W1*0.5 + W2*0.5.
 
F

faraz

one step further now.... ..

im able to overlap any sides of the shapes now........

my another question is i want a relative position of two shapes
for example shape1 is at pin1X,Pin1 and shape2 is at pin2X,pin2Y... now
i want the relative distance and position between these shapes so that
in any other drawing if i enable this setting this to any other shapes
they would be at the same distance as shape1 and shape2..


hope you understand my problem .....
 
J

JuneTheSecond

You can caluculate distance using these properties.
For convenience, Visio shape has DistanceFrom property,
and DistanceFromPoint property.
Did you check the Visio help?
 
F

faraz

but i couldnt get DistanceFrom property to work for relative distance
between two shapes...
 
P

Paul Herber

but i couldnt get DistanceFrom property to work for relative distance
between two shapes...

the DistanceFrom property always returns a value in Inches. Multiply
by 25.4 to get mm.
 
F

faraz

thanks for reply....

but even if got the distance in mm i still dont know where to place
the shape2 becuase that distance can be anywhere around the shape...
 
D

David Parker

It is conceivable that the shapes are not "pinned" exactly in the centre of
each shape. Thus, it is more correct to use the LocPinX and LocPinY in your
formulae because they will give the distance of the "pin" position from the
bottom left of each shape.

You will need to decide how to use this in your formulae because you are
chosing how to align your shapes.

For example, for left aligned, if Sheet.1 is at X,Y Then
Sheet.2.PinX="=Sheet.1!PinX-Sheet.1!LocPinX+LocPinX"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top