# Create Model from segment with certain color

**URL:** <https://discourse.slicer.org/t/create-model-from-segment-with-certain-color/14294>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [October 28, 2020, 11:39pm UTC](https://discourse.slicer.org/t/create-model-from-segment-with-certain-color/14294 "2020-10-28T23:39:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christos\_Tzerefos](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/christos_tzerefos/32/8544_2.png) [@Christos\_Tzerefos](https://discourse.slicer.org/u/Christos_Tzerefos)\
**Post date:** [October 28, 2020, 11:39pm UTC](https://discourse.slicer.org/t/create-model-from-segment-with-certain-color/14294/1 "2020-10-28T23:39:45Z")

</div>

Hello to all,  
I managed to create a model from a segmentation.

> shNode = slicer.mrmlScene.GetSubjectHierarchyNode()  
> sceneItemID = shNode.GetSceneItemID()  
> exportFolderItemId = shNode.CreateFolderItem(sceneItemID , “Models”)  
> FinalModel = slicer.modules.segmentations.logic().ExportAllSegmentsToModels(segmentationNode, exportFolderItemId)

How can I set the color of the model? I tried to use the following code but the final model had no details.

> FinalModel=slicer.mrmlScene.GetFirstNode(NameOfModel,‘vtkMRMLModelNode’)  
> modelDisplayNode = FinalModel.GetDisplayNode()  
> modelDisplayNode .SetColor(250,0,0)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 28, 2020, 11:46pm UTC](https://discourse.slicer.org/t/create-model-from-segment-with-certain-color/14294/2 "2020-10-28T23:46:30Z")

</div>

Colors of the exported models are taken from the segment colors, so the easiest is to set the segment’s color before the model export.
