Aligning a pin to the centre of a circle

3 views
Skip to first unread message

indy2005

unread,
Aug 17, 2010, 7:19:25 PM8/17/10
to Mekanimo
Hi,

I am trying to model a motorbike. I have a circle and a rectangle
(the suspension), and need to pin the rotated rectangle directly
through the centre of the wheel circle.

When I pin the shapes, I can see that Body1 is the rectangle and Body2
is the wheel. I can edit the x and y values on the rectangle, but I
need to make the adjustment to the Body2 x and y i.e. the wheel.

The values for Body2 X and Y are "none", but any changes I make here
dont seem to affect the pin position. Nor can I enter "None" into the
Body1 x and y values, nor - once I have changed Body2 X and Y can I
reset that to "None" as it now sees this as a bad value (depsite it
being the default).

Also, is there any way to "align shapes" or is it just a case of
manually editing the x and y components?

Many thanks, as always

i

Fahreddın Basegmez

unread,
Aug 17, 2010, 9:07:20 PM8/17/10
to meka...@googlegroups.com
Hi,

Motors, pins, torsional springs use b1x (x in body1's coordinates) and b1y (y in body1's coordinates) to position themselves.  b2x and b2y values are computed internally when necessary.  This way these connectors can have only one position as they should.  This is done deliberately to avoid guessing.

There are several things you can do to align the pin to the circle.

1- Right click on the circle and select bring to front from the menu.  This way when you create the pin joint circle becomes the first body.  Then you can set the b1x and b1y values as zero if necessary.

2- Similarly, right click on the rectangle and select send to back from the menu.

3- Modify the code and change body1 to circle1 and b1x and b1y to zero.

4- Manually create the code as shown below

pin(circle1, rectangle1, 0, 0)

5- In the interpreter (or in the code panel) type

>>> x, y = bodyToWorld(circle1, 0, 0)
>>> bx, by = worldToBody(rectangle1, x, y)

Then use these bx and by values for b1x and b1y for rectangle1 as body1

To align shapes you can use the grid and snap to grid options while creating the elements.  Aligning elements after they are created (similar to other graphics programs) is in my to do list but I could not get to it yet. 

Hope this helps.

Fahri


--
You received this message because you are subscribed to the Google Groups "Mekanimo" group.
To post to this group, send email to meka...@googlegroups.com.
To unsubscribe from this group, send email to mekanimo+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mekanimo?hl=en.


indy2005

unread,
Aug 18, 2010, 5:24:22 AM8/18/10
to Mekanimo
Great....thanks as always.
> > mekanimo+u...@googlegroups.com<mekanimo%2Bunsubscribe@googlegroups.c om>
> > .
Reply all
Reply to author
Forward
0 new messages