My next issue which is somewhat coupled with the first. In AutoCAD I would develop a custom command in C# using attributes like this:
[CommandMethod("pyfile", CommandFlags.Transparent)]
public void pythonfile()
{
// Create a new instance of PythonEngine and set variables.
PythonEngine engine = new PythonEngine();
engine.AddToPath(Environment.CurrentDirectory );
// Send Stdout and Stderr to the AutoCAD command line.
engine.SetStdout(new AcadCommandLine());
engine.SetVariable("null", null);
// Display an OpenFileDialog and run the script.
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Python files (*.py)|*.py|All files (*.*)|*.*" ;
ofd.ShowDialog();
// Run the file selected by the open file dialog box.
engine.RunFile(ofd.FileName);
}
Basically I need to come up with some method of defining that CommandMethod Attribute from python file. I'm not necessarily concerned how ugly of a hack it will be but I need a method of defining custom commands from an external file.
Anyone have any thoughts/ideas on this. I'm not necessarily looking for a full code solution, however some pointer would be extremely helpful.
Thanks for reading,
Tim Riley
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
