TheSwamp
Code Red => .NET => Topic started by: MP on October 25, 2008, 01:05:06 AM
-
http://www.codeplex.com/IronScheme
(http://i33.tinypic.com/2hfnv5s.png)
-
Can we make it work in AutoCAD? :laugh:
-
Yes, this could be made to work with AutoCAD.
If one where to update the code I have for PyAcad.NET to use IronPython 2.X code you could run IronPython, IronRuby and IronScheme from PyAcad.NET as all make use of the DLR provided in IronPython's code base.
-
I tried to do it but it didn’t work. I’ll wait till L sharp v2 is released and try that.
-
Can you post the code you used? 2.x is a very different beast than 1.x.
-
Nothing to show really, I tried to evaluate a few commands as show in this thread but failed.
http://www.codeplex.com/IronScheme/Thread/View.aspx?ThreadId=36625
There is zero documentation to go off of.
-
this works
#region
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using AcEd = Autodesk.AutoCAD.EditorInput;
using AcAp = Autodesk.AutoCAD.ApplicationServices;
using IronScheme;
using IronScheme.Hosting;
using IronScheme.Runtime;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
#endregion
[assembly: CommandClass(typeof(LispAcadDotNet.AcadInterface))]
namespace LispAcadDotNet
{
public class AcadInterface
{
[CommandMethod("doit")]
public static void doit()
{
ScriptDomainManager mgr = ScriptDomainManager.CurrentManager;
IronSchemeLanguageProvider slp = new IronSchemeLanguageProvider(mgr);
ScriptEngine se = slp.GetEngine();
IronScheme.Runtime.Builtins.Load("~/ironscheme.boot.pp");
AcAp.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("{0}",
se.Evaluate( String.Format( "(eval-r6rs {0})", "(+ 1 2 )")));
}
}
}
-
Pretty cool you guys, pretty cool.
-
Very cool Dan.
Wonder what it would take to update my IronPython AutoCAD embedding up to 2.0 DLR, include this code and also get IronRuby embedding in the same DLL. It would be need to have "runpyfile", "runrbfile" and "runscfile" from the same DLL, embedding the 3 languages.
Perhaps after I figure out my table issue I will try my hand at it. Unless someone gets there first. (looks at Dan).
-
perhaps something along these lines Tim -
http://blogs.msdn.com/seshadripv/archive/2008/06/30/how-to-invoke-a-python-function-from-c-using-the-dlr-hosting-api.aspx
just replace 'string pyFunc' with the python file text and a bit of parsing to find the method names and register the commands, there may even already be a 'pyEng.CreateScriptSourceFromFile' method (I'd like to think so anyway).
this may be a band aid also - https://blogs.msdn.com/seshadripv/archive/2008/06/24/how-to-write-a-simple-dlr-host-in-c-using-hosting-api.aspx
I was thiking of having C# look up the file names and use them as the commands, each file performs just one task/command and C# just needs to look up the files at loading.
Just a thought...:)