Method for producing a three-dimensional component having one or more cavities by powder-based additive manufacturing, i.e. selective laser melting or electron beam melting, using an additive manufacturing machine, said method comprising the steps of: a) creating 3D-CAD-data of the component to be produced using a computer-aided design method, wherein said 3D-CAD-data are suitable to be processed by the additive manufacturing machine; b) identifying the cavities of the component in the 3D-CAD-data and verifying, that each cavity has at least one outlet passage connecting the cavity to the outer environment of the component, wherein, if there is no such outlet passage, it is created within the 3D-CAD-data; c) producing the component on a construction platform of the additive manufacturing machine on the basis of the 3D-CAD-data; d) removing powder present within the cavities and within the outlet passages through said outlet passages and e) heat-treating the construction platform and the component arranged thereon in a heat treatment oven, wherein at least the sub-steps of step b) of identifying the cavities of the component within the 3D-CAD-data and of verifying, that each cavity has at least one outlet passage connecting the cavity to the outer environment of the component, are performed automatically by applying an algorithm on the 3D-CAD-data, and, if a cavity without an outlet passage is detected, an outlet passage is automatically calculated and automatically created in the 3D-CAD-data characterized in that step b) further comprises the steps of detecting whether one or more cavities have outlet passages blocked by the construction platform and, if one or more cavities havinq outlet passages blocked by the construction platform are detected, automatically verifying whether or not alternative orientations of the component relative to the construction platform are possible, which lead to less or no missing outlet passages, and, if an alternative orientation is found, automatically choosing said alternative orientation and automatically calculating and creating missing or modified outlet passages in the 3D-CAD-data. a) creating 3D-CAD-data of the component to be produced using a computer-aided design method, wherein said 3D-CAD-data are suitable to be processed by the additive manufacturing machine; b) identifying the cavities of the component in the 3D-CAD-data and verifying, that each cavity has at least one outlet passage connecting the cavity to the outer environment of the component, wherein, if there is no such outlet passage, it is created within the 3D-CAD-data; c) producing the component on a construction platform of the additive manufacturing machine on the basis of the 3D-CAD-data; d) removing powder present within the cavities and within the outlet passages through said outlet passages and e) heat-treating the construction platform and the component arranged thereon in a heat treatment oven, wherein at least the sub-steps of step b) of identifying the cavities of the component within the 3D-CAD-data and of verifying, that each cavity has at least one outlet passage connecting the cavity to the outer environment of the component, are performed automatically by applying an algorithm on the 3D-CAD-data, and, if a cavity without an outlet passage is detected, an outlet passage is automatically calculated and automatically created in the 3D-CAD-data characterized in that step b) further comprises the steps of detecting whether one or more cavities have outlet passages blocked by the construction platform and, if one or more cavities havinq outlet passages blocked by the construction platform are detected, automatically verifying whether or not alternative orientations of the component relative to the construction platform are possible, which lead to less or no missing outlet passages, and, if an alternative orientation is found, automatically choosing said alternative orientation and automatically calculating and creating missing or modified outlet passages in the 3D-CAD-data.