Yes, you 've right, I just don't interpreted your answer. Now that is work, but my other question, if I want to execute the script, I get a "NullReferenceException was unhandled" error.
Do you have any idea why?
public class MyPlugin: IPlugin
{
private IGlobal _global;
public void Initialize(IGlobal global, ISynchronizeInvoke sync)
{
// Use or store global for later use...
this._global = global;
}
internal static IValue MaxScriptExecute(string str, IGlobal global)
{
bool res = false;
return global.ExecuteScript(global.StringStream.Create(str), res);
}
public void runScript()
{
IINode myNode = MaxScriptExecute("assembly = dotNet.loadAssembly \"C:\\temp_viewer\\max.dll\""+
"ThisTestObject = dotNetObject \"max.TestObject\""+
"end = (ThisTestObject.readFromFile \"C:\\temp_viewer\\test.txt\")" +
"for i= 0 to end - 1 do"+
"("+
"actionMan.executeAction 0 \"40021\" -- Selection: Select All" +
"actionMan.executeAction 0 \"40020\" -- Edit: Delete Objects" +
"Box lengthsegs:1 widthsegs:1 heightsegs:1 length:(ThisTestObject.zValue i) width:(ThisTestObject.xValue i) height:(ThisTestObject.yValue i) mapcoords:on pos:[-2.95203,1.10701,-130] isSelected:on"+
"modPanel.addModToSelection (Edit_Poly ()) ui:on"+
"meditMaterials[1] = Multimaterial ()"+
"meditMaterials[1].material1.diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\top.bmp\")"+
"meditMaterials[1].materialList[2].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\bottom.bmp\")"+
"meditMaterials[1].materialList[3].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\left.bmp\")"+
"meditMaterials[1].materialList[4].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\right.bmp\")"+
"meditMaterials[1].materialList[5].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\front.bmp\")"+
"meditMaterials[1].materialList[6].diffuseMap = Bitmaptexture fileName:((ThisTestObject.pathValue i) + \"\\back.bmp\")" +
"$.material = meditMaterials[1]" +
"ExportFile (\"C:\\temp_viewer\\rubic_cube\" + (i as string)+ \".fbx\") #noPrompt"+
")", _global).ToNode;
}
}
}