Multiple segment

i’m adding 2nd segment under same masterNode, But whenever i try to apply effects on it’s getting applied on 1st segment only,
How to select 2nd segment as active segment???

You need to select the second segment in the segment list. It’s always the highlighted one that is edited by the selected effect.

Programmetically you can select a segment using setCurrentSegmentID method of the segment editor widget.

addsegID = segmentationNode.GetSegmentation().AddEmptySegment(“bone”)
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorNode = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLSegmentEditorNode”)
Traceback (most recent call last):
File “C:\Program Files\Slicer 4.9.0-2018-03-27\lib\Slicer-4.9\qt-scripted-modules\SegmentEditorEffects\SegmentEditorEffects\”, line 54, in activate
self.segment2DFillOpacity = displayNode.GetSegmentOpacity2DFill(segmentID)
TypeError: GetSegmentOpacity2DFill argument 1: string is required

i’m getting this error when i try to switch on 2nd segment to apply effect

Based on the code snippet you posted there is no variable named segmentID, so getting the error is expected. You have one variable storing a segment ID called addsegID. Maybe you wanted to use that?

Another issue is that here you probably wanted to set the string that is stored in addSegID variable, so the quotes around addSegID must be removed.

ohh yes that was the fault, thanks