Remove Target in corridior Region

Hi Guys,
I am triying to remove object in corridor target.
Civil3DToolKit has the ability to add but do not remove (almost I couldnt get it).

In Civil3DToolKit node SubassemblyTargetInfo.SetTargets requiered Object, if I use anything else diferent to object warning is shown. There is a way to set none Object?

My second try was python. In my code I fuse one baseline and one region to try to remove object. But SubasemblyTargetInfro required ObjectIdCollection, I had read a lot post and forum about this but we cant create ObjectIdCollection. So when I run my code warning said

TypeError: expected SubassemblyTargetInfoCollection, got ObjectIdCollection

Any idea how to fix it?

coor = IN[0]

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            # 
            i=[]
            TgtTds=[]
            obj = coor.InternalObjectId
            objid = t.GetObject(obj, OpenMode.ForWrite)
            baseline = objid.Baselines[1]
            region = baseline.BaselineRegions[0]
            target = region.GetTargets()
            
            
            for x in target:
            	CorTargetIds = x.TargetIds
            	CorTargetIds.Clear()
                region.SetTargets(CorTargetIds)
               # Commit before end transaction
            t.Commit()
            pass

You can create an Object Id Collection like this :

#Create an object id collection
    oic = ObjectIdCollection() 
1 Like

HI David Thanks,
I going to try your idea.
At this moment I got my goals in this way.
I get help form this post Remove targets in corridor baselines not working

    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            # 
            i=[]
            Tgt=[]
            obj = coor.InternalObjectId
            objid = t.GetObject(obj, OpenMode.ForWrite)
            baseline = objid.Baselines[1]
            region = baseline.BaselineRegions[0]
            target = region.GetTargets()
            
            n=0
            for x in target:
            	CorTargetIds  = x.TargetIds
            	CorTargetIds.Clear()
            	x.TargetIds = CorTargetIds
            
            region.SetTargets(target)

            # Commit before end transaction
            t.Commit()
            pass