Example #1
0
        static void Main(string[] args)
        {
            string exchange_folder = null;
            string input_file      = null;

            for (var arg = 0; arg < args.Length; ++arg)
            {
                if (arg < args.Length - 1)
                {
                    if (args[arg] == "--exchange")
                    {
                        exchange_folder = args[++arg];
                        continue;
                    }
                }
                input_file = args[arg];
            }

            if (null == input_file)
            {
                Console.WriteLine("Please provide an input file as an argument.");
                return;
            }


            try {
                Library.Initialize(HOOPS_LICENSE.KEY, exchange_folder);
            } catch (Library.InitializationException e) {
                Console.WriteLine(e.Message);
                return;
            }

            A3DRWParamsLoadData load_params;

            API.Initialize(out load_params);
            IntPtr model_file;

            if (A3DStatus.A3D_SUCCESS != API.A3DAsmModelFileLoadFromFile(input_file, ref load_params, out model_file))
            {
                Console.WriteLine("Failed to load input file.");
                return;
            }

            var model_file_data = new A3DAsmModelFileWrapper(model_file);
            int indent          = 0;

            Write(GetName(model_file), indent++);
            for (int idx = 0; idx < model_file_data.m_uiPOccurrencesSize; ++idx)
            {
                var po = Marshal.ReadIntPtr(model_file_data.m_ppPOccurrences, idx * Marshal.SizeOf(typeof(IntPtr)));
                RecursivelyPrintName(po, indent);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            string exchange_folder = null;
            string input_file      = null;

            for (var arg = 0; arg < args.Length; ++arg)
            {
                if (arg < args.Length - 1)
                {
                    if (args[arg] == "--exchange")
                    {
                        exchange_folder = args[++arg];
                        continue;
                    }
                }
                input_file = args[arg];
            }

            if (null == input_file)
            {
                Console.WriteLine("Please provide an input file as an argument.");
                return;
            }


            try {
                Library.Initialize(HOOPS_LICENSE.KEY, exchange_folder);
            } catch (Library.InitializationException e) {
                Console.WriteLine(e.Message);
                return;
            }

            A3DRWParamsLoadData load_params;

            API.Initialize(out load_params);
            IntPtr model_file;

            if (A3DStatus.A3D_SUCCESS != API.A3DAsmModelFileLoadFromFile(input_file, ref load_params, out model_file))
            {
                Console.WriteLine("Failed to load input file.");
                return;
            }

            var          model_file_data = new A3DAsmModelFileWrapper(model_file);
            InstancePath owners          = new InstancePath();

            owners.Add(model_file);
            var po     = Marshal.ReadIntPtr(model_file_data.m_ppPOccurrences);
            var result = GetAllPartInstances(po, owners);

            Console.WriteLine("There are " + result.Count + " part instances.");
        }