How Get ID of a Offset Entity

Hallo,

I have a problem with the new segment created with SketchOffsetEntities2, becouse after the creation, The segment is automatically deselection.

To obtain the ID of the new segment I thought of scanning all the entities of the sketch and get the latest entity, but it is the correct way?

This is my simple code:

           For i = 1 To 1
                swSelObj = swSelMgr.GetSelectedObject3(i)

                'if it is an edge
                If swSelMgr.GetSelectedObjectType2(i) = 1 Then
                    swSelMgr = MyModDoc.SelectionManager
                    boolstatus = MyModDoc.SketchOffsetEntities2(-0.01, False, False)
                   
'now I want to select the segment you just created and get the ID for future selections

            next

Thanks

Roberto

SolidworksApi macros