TheSwamp

Code Red => .NET => Topic started by: MP on October 25, 2008, 01:05:06 AM

Title: IronScheme 1.0 Beta 1
Post by: MP on October 25, 2008, 01:05:06 AM
http://www.codeplex.com/IronScheme

(http://i33.tinypic.com/2hfnv5s.png)
Title: Re: IronScheme 1.0 Beta 1
Post by: It's Alive! on October 25, 2008, 12:59:31 PM
Can we make it work in AutoCAD?  :laugh:
Title: Re: IronScheme 1.0 Beta 1
Post by: tjr on October 27, 2008, 10:09:50 AM
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.
Title: Re: IronScheme 1.0 Beta 1
Post by: It's Alive! on October 27, 2008, 10:59:54 AM
I tried to do it but it didn’t work. I’ll wait till L sharp v2 is released and try that.
Title: Re: IronScheme 1.0 Beta 1
Post by: tjr on October 27, 2008, 11:06:29 AM
Can you post the code you used? 2.x is a very different beast than 1.x.
Title: Re: IronScheme 1.0 Beta 1
Post by: It's Alive! on October 27, 2008, 11:42:47 AM
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.
Title: Re: IronScheme 1.0 Beta 1
Post by: It's Alive! on October 27, 2008, 12:00:47 PM
this works

Code: [Select]
#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 )")));
    }
  }
}

Title: Re: IronScheme 1.0 Beta 1
Post by: MP on October 27, 2008, 02:36:26 PM
Pretty cool you guys, pretty cool.
Title: Re: IronScheme 1.0 Beta 1
Post by: tjr on October 27, 2008, 02:50:36 PM
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).
Title: Re: IronScheme 1.0 Beta 1
Post by: MickD on November 13, 2008, 04:10:25 AM
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...:)