We introduce a novel digital factory layout tool that optimizes both the layout of machines and the corresponding ergonomic logistics considering space constraints. A model is constructed by tangible properties on machines and environment, regions on the floor and by ranking their mutual relations. An optimized layout is then computed based on the model, the relations and an ergonomic score for the human work tasks, which are automatically computed by digital manikins. The result is an optimized layout, visualized in 3D, with improved logistic routes. The layout tool has been implemented and successfully tested on a relevant industrial case.