To satisfy rising flexibility and reconfigurability, the combination of system design and control software design has been adopted as a common paradigm for engineering manufacturing systems. However, there is still a lack of efficient approaches to automating the projection from the system design to the control software dimension. In this study, a model-driven approach is proposed to generate the control logic design based on the IEC 61499 Function Block from the system design in SysML. First, the system design model is formally defined to be unambiguously interpreted. Second, the SysML-FB profile is defined based on which control logic can be modelled in compliance with the IEC 61499 Function Block in the unified SysML modelling environment. Third, transformation rules between these two models are proposed, according to which a distributed event-driven control logic design can be automatically generated. This approach is implemented as a computer-aided design tool extended from the mainstream SysML modelling platform MagicDraw and illustrated using a computer numerical control bending machine as the case study.