bodys and anchor points

Consider the following pusdo code
Code:
float x=0;
for(i=0;i<10;i++)
{
  x+=addPremadeShapeAndReturnWidth(x,0);
}

Im experimenting with box2d and I made some shapes via physics editor. Each shape has some Y point that represents the height of the "track" that a ball will roll across from left to right. In order for this to work each shape has to have its y point at this given height line up on both the left and right edges. In the physics editor I can specify an anchor point to ensure that the sprites render correctly in relation to the body. What I really want to do is to be able to have the bodys have anchor points such that I know if I place 1 object at x,0 and another object at x+1,0 their horizontal surfaces will line up at the same height where the 2 touch.

What I seem to be missing is a way to denote what this "connect height" is for every object without having to hard code everything.

As a final example if I make a simple box, and want that boxes top to be at this same height as all the other track pieces, it would be nice to be able to add the box at X,0 and know that its top lines up. Instead you have to get the shape from the fixtures list, get the height and shift the box down by the height to accomplish this.

So my question is, is there a good way to standardize anchor points in the way I want to use them or is it required that the code align each shapes Y using a stored value for height to line shapes up. What I am trying to do is set all my objects anchor points and then just use the same Y value for everything.

Original thread: https://box2d.org/forum/viewtopic.php?t=6772