|
I want you to teach how to use Arguments in C#.
I know about how to use input Arguments in Jscript.
It is written in SDK Guide.Also C++ is written.
Please see the following source of C#.
I want just use ArgsXXX in LogMessage command.
Plase tell me that.
public bool Init( Context in_ctxt )
{
Command oCmd = null;
oCmd = (Command)in_ctxt.Source;
oCmd.Description = "";
oCmd.ReturnValue = true;
ArgumentCollection oArgs = null;
oArgs = oCmd.Arguments;
oArgs.Add("ArgsXXX",siArgumentFlags.siArgumentInput,null,siVariantType.siEmpty)
return true;
}
public bool Execute( Context in_ctxt )
{
Log("Execute called")
//
// TODO: Put your command implementation here.
//
CXSIApplicationClass app = new CXSIApplicationClass()
//How to use "ArgsXXX"?
app.LogMessage(ArgsXXX, siSeverity.siInfo)
return true;
}
|
|
|
|
Take a look at some of the C# examples in the SDK Example workgroup.
public class SimpleCSCommand : Base
{
// Called by Softimage to initialize the SimpleCSCommand arguments
public bool Init( Context in_ctxt )
{
Command oCmd = (Command)in_ctxt.Source;
oCmd.Description = "A simple command sample";
oCmd.ReturnValue = true;
ArgumentCollection oArgs = oCmd.Arguments;
oArgs.AddWithHandler("Collection",StringModule.siArgHandlerCollection,null)
oArgs.Add("LogFullName",siArgumentFlags.siArgumentInput,true,siVariantType.siBool)
return true;
}
// Called by Softimage to execute SimpleCSCommand
public bool Execute( Context in_ctxt )
{
Log("SimpleCSCommand.Execute called")
Array args = (Array)in_ctxt.GetAttribute("Arguments")
XSICollection collection = null;
bool bLogFullName = false;
try
{
// Retrieve the command arguments.
// Note: The arguments are stored in an Array of type Object, therefore
// you must perform a type cast to the right type when acessing the arguments
// otherwise compiler error will occur.
collection = (XSICollection)args.GetValue(0)
bLogFullName = (bool)args.GetValue(1)
Traverse((SIObject)collection[0], 0, bLogFullName)
}
catch(Exception e)
{
Error(e.ToString())
}
return true;
}
|
|
|
|
StephenBlair,Thank you for answering for my really basic question.
Your advice is very helpful for solution of my troubles.
I forgot SDK Example workgroup.
Thanks!
yusaku.
|
|
|