static void PrintConvertProgress(udSDK.Convert.udConvertContext convertContext) { System.Threading.Thread conversionThread = new System.Threading.Thread(new System.Threading.ThreadStart(convertContext.DoConvert)); conversionThread.Start(); ulong currentItem = 1; while (!conversionThread.Join(50)) { if (currentItem != convertContext.Status.currentInputItem) { currentItem = convertContext.Status.currentInputItem; Console.Write("\n"); } string fn = Marshal.PtrToStringUTF8(convertContext.CurrentItem.pFilename); Console.Write("\rReading {0} ({1}/{2}): {3}/{4} points read ({5} total read)", fn, convertContext.Status.currentInputItem + 1, convertContext.Status.totalItems, convertContext.CurrentItem.pointsRead, convertContext.CurrentItem.pointsCount, convertContext.Status.totalPointsRead); } }
static void Convert(string inputPath, string outputPath, udSDK.udContext context) { udSDK.Convert.udConvertContext convertContext = new udSDK.Convert.udConvertContext(context); convertContext.AddFile(inputPath); convertContext.OutputFile = outputPath; convertContext.TempDirectory = "./customTemp/"; convertContext.PointResolution = 0.1; convertContext.SRID = 28356; convertContext.SkipErrors = true; convertContext.GlobalOffset = new double[] { 1, 2, 3 }; udSDK.Convert.udConvertItemInfo input = convertContext.inputItems[0]; input.srid = 28354; // this sets the internal item srid value // metadata can be set in the following way: convertContext.metadata["Copyright"] = "Euclideon Pty"; // we can read the current metadata as a string using convertContext.metadata.JsonString // The following function demonstrates printing the conversion status as the converion is running in a separate thread: PrintConvertProgress(convertContext); // Alternatively this runs the conversion in this thread: //convertContext.DoConvert(); }