ChronoEngine_SwAddin.SWTaskpaneHost.PythonTraverseComponent_for_massbodies C# (CSharp) Метод

PythonTraverseComponent_for_massbodies() публичный Метод

public PythonTraverseComponent_for_massbodies ( Component2 swComp, object &obodies, int &addedb ) : void
swComp Component2
obodies object
addedb int
Результат void
        public void PythonTraverseComponent_for_massbodies(Component2 swComp, ref object[] obodies, ref int addedb)
        {
            // Add bodies of this component to the list
            object[] bodies;
            object bodyInfo;
            bodies = (object[])swComp.GetBodies3((int)swBodyType_e.swAllBodies, out bodyInfo);

            if (bodies != null)
            {
                // note: some bodies might be collision shapes and must not enter the mass computation:
                for (int ib = 0; ib < bodies.Length; ib++)
                {
                    Body2 abody = (Body2)bodies[ib];
                    if (!(abody.Name.StartsWith("COLL.")))
                    {
                        obodies[addedb] = bodies[ib];
                        addedb += 1;
                    }
                }

            }

            // Recursive scan of subcomponents

            Component2 swChildComp;
            object[] vChildComp = (object[])swComp.GetChildren();

            for (long i = 0; i < vChildComp.Length; i++)
            {
                swChildComp = (Component2)vChildComp[i];

                PythonTraverseComponent_for_massbodies(swChildComp, ref obodies, ref addedb);
            }
        }