Hi!
I am having a problem exporting models as obj files.
I have created a model hierarcy node and filled it as follows:
exportedModelsNode = slicer.mrmlScene.AddNewNodeByClass(‘vtkMRMLModelHierarchyNode’)
slicer.modules.segmentations.logic().ExportAllSegmentsToModelHierarchy(seg, exportedModelsNode)
Now I want to get model nodes under newly created model hierarcy node with a for loop using below code.
slicer.modules.models.logic().SaveModel(‘C:/Users/Desktop/aaa.obj’, modelNode)
How can I get model nodes inside exportedModelsNode ??
I would recommend to use slicer.modules.segmentations.logic().ExportSegmentsClosedSurfaceRepresentationToFiles() method directly.
Thanks, that did the job.
Also, I managed to get nodes by:
modelNodes = slicer.mrmlScene.GetNodesByClass(‘vtkMRMLModelNode’)
1 Like