How iterate over BRepCheck_ListOfStatus? Always facing crash at const it = statusList.begin();

I am using opencascade.js and trying to build a solid out of a shell. I am trying to detect problems in the shell by running the analyzer. However, when I try to iterate over BRepCheck_ListOfStatus, I see a crash on line const it = statusList.begin();

statusList has a size of 1.

Please suggest a solution on how to use the iterator

=============================================

const analyzer = new this._oc.BRepCheck_Analyzer(shell, true, false);
if (!analyzer.IsValid_2()) {
  console.warn("Shell is not valid!");

  const resHandle = analyzer.Result(shell);
  const res = resHandle.get();

  // Print general status code
  const statusList: BRepCheck_ListOfStatus = res.Status();
  const size = statusList.Size();

  console.log("Status list size:", size);

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

    it.Next();
  }
  it.delete();
} else {
  console.log("Shell is valid!");
}

================================

Dmitrii Pasukhin's picture

Hello. The most native way of using OCCT container's iterators - use Iterator object, which is a namespace declaration inside container. Example:

BRepCheck_ListOfStatus aList;
for(BRepCheck_ListOfStatus::Iterator anIter(aList); anIter.More(); anIter.Next())
{
const auto& aValue = anIter.Value();
}

JS version is not so well know by me, I can't help with their implementation.

Best regards, Dmitrii.