[Closed] [sdk][C#] ExportToFile options?
I am trying to write a C# function that will export selected as FBX using ExportToFile, but I am not sure how to specify all of the parameters.
the code hint in visual studio shows:
bool IInterface.ExportToFile(string name, bool supressPrompts, uint options, IClass_ID exporterID)
name and supressPrompts are obvious.
but what about options and exporterID?
public static string fbxExport(string filePath)
{
uint options=Convert.ToUInt32("SCENE_EXPORT_SELECTED"); //will this work?
IClass_ID exporterID =(<?where Do I look up the value for FBX?>);
Interface.ExportToFile(filePath,true,options,exporterID );
}
options:
the SDK docs indicate that options is a DWORD value in C++ but here in C# it’s uint.
C++ value I want would be SCENE_EXPORT_SELECTED per the docs.
Research showed that DWORD is a 32 bit value so I am hoping that converting the string “SCENE_EXPORT_SELECTED” inot a 32bit uint will so the trick.
exporterID:
this would be an IClass_ID object whose value is whatever the FBX exporter’s ID is. How do I get this value?
SCENE_EXPORT_SELECTED is not a “string” it’s preprocesser macro substitution, where
ever its placed in code its replaced with it’s defined value by the compiler at compile time
in this case (1<<0)
#define SCENE_EXPORT_SELECTED (1<<0)
which would compile to the integer value 1.
the call to that function in c++ could read
Class_ID fbxID(0x27227747,0xDD6978);
GetCOREInterface()->ExportToFile(filename,true,1,&fbxID);
btw you can get the class id of any max object from mxs using the following
FBXEXP.classid
Thanks for your reply. This is a level of coding deeper than I have been to before.
I’ll try and see if I can shoehorn this into C#
Amazing. It works!
public static string fbxExport(string filePath)
{
string fullPath=Path.Combine(filePath);
IClass_ID exporterID = Global.Class_ID.Create(0x27227747, 0xDD6978);
Interface.ExportToFile(fullPath,true,1,exporterID );
return fullPath;
}
In thiscase, Global and Interface were defined elsewhere in the parent class
<...>
using Autodesk.Max;
using System.IO;
<...>
namespace MyNamespace
{
public class MyParentClass
{
static public IGlobal Global = Autodesk.Max.GlobalInterface.Instance;
static public IInterface13 Interface = MaxApi.Global.COREInterface13;
public static string fbxExport(string filePath)
{<...>}
}
}