opencascade.js icon indicating copy to clipboard operation
opencascade.js copied to clipboard

How to iterate over NCollection_List?

Open kerimcharfi opened this issue 3 years ago • 1 comments

I can't use the iterator from NCollection_List.begin(), because of UnboundTypeError

I made this somewhat hacky workaround:

function MoveListToJs(list: TopTools_ListOfShape){
    let res = []
    while(list.Size() > 0){
        res.push(list.First_1())
        list.RemoveFirst()
    }
    list.delete()
    return res
}

Is there a better solution?

kerimcharfi avatar Jan 02 '23 16:01 kerimcharfi

Even I am facing a crash when iterating over BRepCheck_ListOfStatus (using opencascade.js)

const statusList: BRepCheck_ListOfStatus = res.Status();

 const it = statusList.begin();  //Crash
      while (!it.isEqual(statusList.end())) {
        const status = it.Value(); 
        console.log("Status code or enum:", status);      
        it.Next();
      }

Have you found a solution to this problem?

rahul-deshmane avatar Jun 03 '25 09:06 rahul-deshmane