Python conversion between model and segment

Hi,
thanks for providing this great Software.

I am trying to change Models to Segments and Segments to Models using Python. This can easily be done using the GUI.
Model to Segmentation
Model_to_segment

Segmentation to Model

Segments_to_models

This is what I have found so far.
Converting Models to Segments

Create segmentation

segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
segmentationNode.CreateDefaultDisplayNodes() 
addedSegmentID = segmentationNode.GetSegmentation().AddEmptySegment("Segment")

modelNode = slicer.util.getNode('Model')
segmentationNode = slicer.util.getNode('Segmentation')

slicer.modules.segmentations.logic().CreateSegmentFromModelNode(modelNode, segmentationNode)

The segmentation is then empty somehow.

Thanks in advance

I would recommend to use higher-level (import/export) methods of segmentations logic. See examples in the script repository.