Advanced mates in Solidworks

Help! I’m trying to mate a piece so that it pivots around a pin without hiting the side of a box. The range of motion is starting from a 90 degree position and swings until 270 degrees (180 degree limited swing) I have spent hours trying to make a mate but all I get is that the model is overdefined.

you have to build a construction geometry that fits your swing action. the pin should have an axis in center. go to view and check temporary axis. you’ll see the axis showing. if not you have to create your own axis by making a sketch of it using a centerline, then get out of the sketch go to insert>axis>pick centerline>ok. do this in part mode.

once you have the axis then you construct a circle (using a sketch) on the part that’s moving.

then mate center coincident to the axis in assembly mode. the radius of the circle should equal the distance between the axis and the tolerance (the edge point of the box or greater).