Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / How to use inpurt Arguments in C#?
  RSS 2.0 ATOM  

How to use inpurt Arguments in C#?
Rate this thread
 
36688
 
Permlink of this thread   Subscribe to this thread
avatar
  • yusaku
  • Posted: 14 November 2009 05:16 AM
  • Total Posts: 3
  • Joined: 05 May 2009 11:38 AM

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(ArgsXXXsiSeverity.siInfo)

 
return true;
 
}


Replies: 0
avatar

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]
0bLogFullName)
 }
 catch(Exception e)
 {
 Error(e
.ToString())
 } 

 
return true;
 
}


Replies: 0
avatar
  • yusaku
  • Posted: 18 November 2009 03:21 AM

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.



Replies: 0




   
  Settings Choose Theme color: