For the Apollo program, there was a device that measured the weight and balance of the completed modules. Page 9-4 of the Apollo Program Summary Report describes the steps in manufacturing the Command Module:
9.1.1.3 Final operations: In the final phase of command module manufacturing, the vehicle was cycled through another tumble-and-clean operation in which the vehicle was rotated through 360° in each axis to dislodge and remove debris. The weight and center of gravity were then determined, and the vehicle was subjected to an integrated test (sec. 9.1.5). The command module was subsequently moved to the shipping area and prepared for shipment. Such items as crew couches and crew equipment were removed, packed, and shipped separately.
The manufacturing of the Service Module is described on page 9-6:
Following the tests, the vehicle was cycled through the tumble-and-clean positioner to dislodge and remove debris. The cleaned vehicle was then weighed and its center of gravity determined. On completion of these operations, the vehicle was placed in the integrated test stand for the integrated test series described in section 9.1.5. The integrated test completed the manufacturing, test, and checkout operations, and the vehicle was mounted on a shipping pallet and prepared for shipment.
Both operations were performed on a piece of equipment called the "weight and balance fixture":