void walkNode(COMApi.InwOaNode parentNode, bool bFoundFirst)
        {
            if (parentNode.IsGroup)
            {
                COMApi.InwOaGroup group = (COMApi.InwOaGroup)parentNode;
                long subNodesCount      = group.Children().Count;

                for (long subNodeIndex = 1; subNodeIndex <= subNodesCount; subNodeIndex++)
                {
                    COMApi.InwOaNode newNode = group.Children()[subNodeIndex];

                    if ((!bFoundFirst) && (subNodesCount > 1))
                    {
                        bFoundFirst = true;
                    }
                    walkNode(newNode, bFoundFirst);
                }
            }
            else if (parentNode.IsGeometry)
            {
                long fragsCount = parentNode.Fragments().Count;
                System.Diagnostics.Debug.WriteLine("frags count:" + fragsCount.ToString());

                for (long fragindex = 1; fragindex <= fragsCount; fragindex++)
                {
                    CallbackGeomListener callbkListener =
                        new CallbackGeomListener();

                    COMApi.InwNodeFragsColl fragsColl = parentNode.Fragments();
                    COMApi.InwOaFragment3   frag      = fragsColl[fragindex];

                    frag.GenerateSimplePrimitives(
                        COMApi.nwEVertexProperty.eNORMAL,
                        callbkListener);
                }

                fragCount    += fragsCount;
                geoNodeCount += 1;
            }
        }
        void walkNode(
            ComApi.InwOaNode parentNode,
            bool bFoundFirst)
        {
            if (parentNode.IsGroup)
            {
                ComApi.InwOaGroup group = (ComApi.InwOaGroup)parentNode;
                long n = group.Children().Count;

                for (long i = 1; i <= n; ++i)
                {
                    ComApi.InwOaNode newNode = group.Children()[i];

                    if ((!bFoundFirst) && (n > 1))
                    {
                        bFoundFirst = true;
                    }
                    walkNode(newNode, bFoundFirst);
                }
            }
            else if (parentNode.IsGeometry)
            {
                ComApi.InwNodeFragsColl fragsColl
                    = parentNode.Fragments();

                CallbackGeomListener cbl
                    = generate_primitives_for_all_fragments
            ? new CallbackGeomListener()
            : null;

                long nFrags = fragsColl.Count;

                Debug.WriteLine("frags count:"
                                + nFrags.ToString());

                for (long i = 1; i <= nFrags; ++i)
                {
                    ComApi.InwOaFragment3 frag = fragsColl[i];

                    if (generate_primitives_for_all_fragments)
                    {
                        frag.GenerateSimplePrimitives(
                            ComApi.nwEVertexProperty.eNORMAL, cbl);
                    }
                    else
                    {
                        // Collect single instance of each fragment
                        // in lookup dictionary for later call to
                        // GenerateSimplePrimitives

                        Array a = (Array)(object)frag.path.ArrayData;

                        //ComApi.InwOaPath p = frag.path;
                        //var a = p.ArrayData;

                        //Array b = (Array) a;
                        //int len = b.Length;
                        //int[] pathArr = b.ToArray<int>();

                        int[] pathArr = a.ToArray <int>();
                        if (!_pathDict.TryGetValue(pathArr,
                                                   out Stack <ComApi.InwOaFragment3> frags))
                        {
                            frags = new Stack <ComApi.InwOaFragment3>();
                            _pathDict[pathArr] = frags;
                        }
                        frags.Push(frag);
                    }
                    _nFragsTotal += nFrags;
                }
                ++_nNodesTotal;
            }
        }