Exemplo n.º 1
0
        static InstancePathArray GetAllPartInstances(IntPtr po, InstancePath owners)
        {
            InstancePathArray result = new InstancePathArray();
            var current_owners       = new InstancePath(owners);

            current_owners.Add(po);

            var part = GetPartDefinition(po);

            if (IntPtr.Zero != part)
            {
                current_owners.Add(part);
                result.Add(current_owners);
                return(result);
            }

            var po_data = new A3DAsmProductOccurrenceWrapper(po);

            for (var idx = 0; idx < po_data.m_uiPOccurrencesSize; ++idx)
            {
                var child_po    = Marshal.ReadIntPtr(po_data.m_ppPOccurrences, idx * Marshal.SizeOf(typeof(IntPtr)));
                var child_paths = GetAllPartInstances(child_po, current_owners);
                result.AddRange(child_paths);
            }

            return(result);
        }
Exemplo n.º 2
0
        static IntPtr GetPartDefinition(IntPtr po)
        {
            if (po == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }

            var d = new A3DAsmProductOccurrenceWrapper(po);

            return(d.m_pPart != IntPtr.Zero ? d.m_pPart : GetPartDefinition(d.m_pPrototype));
        }
Exemplo n.º 3
0
        static void RecursivelyPrintName(IntPtr po, int indent)
        {
            Write(GetName(po), indent);
            indent++;
            var d = new A3DAsmProductOccurrenceWrapper(po);

            for (var idx = 0; idx < d.m_uiPOccurrencesSize; idx++)
            {
                var child_po = Marshal.ReadIntPtr(d.m_ppPOccurrences, idx * Marshal.SizeOf(typeof(IntPtr)));
                RecursivelyPrintName(child_po, indent);
            }
            var part = GetPartDefinition(po);

            if (part != IntPtr.Zero)
            {
                Write(GetName(part), indent + 1);
            }
        }