-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathMRPointsSave.cs
36 lines (31 loc) · 1.33 KB
/
MRPointsSave.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using static MR.DotNet.SelfIntersections;
namespace MR
{
public partial class DotNet
{
public class PointsSave
{
[DllImport("MRMeshC", CharSet = CharSet.Ansi)]
private static extern void mrPointsSaveToAnySupportedFormat(IntPtr pc, string file, ref MRSaveSettings settings, ref IntPtr errorString);
[DllImport("MRMeshC", CharSet = CharSet.Ansi)]
private static extern void mrLoadIOExtras();
/// saves point cloud to file of any supported format
unsafe public static void ToAnySupportedFormat(PointCloud pc, string path, SaveSettings? settings = null)
{
mrLoadIOExtras();
IntPtr errString = IntPtr.Zero;
MRSaveSettings mrSettings = settings is null ? new MRSaveSettings() : settings.Value.ToNative();
mrPointsSaveToAnySupportedFormat(pc.pc_, path, ref mrSettings, ref errString);
if (errString != IntPtr.Zero)
{
var errData = mrStringData(errString);
string errorMessage = MarshalNativeUtf8ToManagedString(errData);
throw new SystemException(errorMessage);
}
}
}
}
}