[AutoCAD and IronRuby]

Hello All,

I am new in .net programming and I have writing ruby codes more then 3
years.
I want to write some codes, taking data from excel files to make
something and
drawing somethings in AutoCAD.

I searched google and found some links about IronRuby and AutoCAD… But,
i could
not find step-by-step integration IronRuby and AutoCAD.

This site

is give me some idea for integration… But i could not find any
information why i use
C# for integration to ruby for autocad.

How can i find the proper information AutoCAD and IronRuby integration?

  • especially
    step-by-step guide -

Thank you for helps now… Regards,

Murat USTUNTAS

I very much doubt that there is a step by step guide for that, since
only
one other person on the world seemed interested in this.

I have no AutoCAD experience, so is not something I can personally help
with. I agree with Andrius in that there are probably very few people
that
would need (or want) this kind of integration. On the other hand, if
AutoCAD has a .NET API then using IronRuby is a least a possibility.

Is there anyone in the IronRuby community familiar with AutoCAD and it’s
API’s willing to give Murat a hand with this?

Mike

@WebCoding4Fun on Twitter

Thank you Mike,

I assume that this is very tricky… But, i hope that somebody knows
about AutoCAD and .NET Api
integration in this comminity…

Regards,

Murat USTUNTAS

The world would be a very boring place if we would do only stuff that
was
already done, wouldn’t it?

I have played around with this.

There are 2 steps:

  1. Using the example given in the “Through the Interface” post you have
    to use an existing .net language to create a “script engine” to allow
    AutoCAD and Ironruby to talk. You should be able to copy Kean Walmsley’s
    script directly, pick the right .dll’s for you version of AutoCAD, load
    them and in your project in either Visual Studio or I have used
    SharpDevelop, and follow the rest of Kean’s directions to run scripts in
    AutoCAD.

That is the hardest part. It took me awhile to get step 1 to work.

  1. Use either the “win32ole” library or .net libraries to connect to
    excel. The best place I have found to read about the win32ole library
    is: Ruby on Windows: excel
    If you want to use .net libraries and you can’t find ironruby examples,
    find VB.net examples and the are the easiest to translate to ruby.

Side Notes:

  1. MRI ruby can connect to autocad using the “win32ole” library. It is
    virtually the same as using VBA. Don’t know how long this ability will
    last since VBA is going away.

  2. David Blackmon has created helper libraries for drawing things in
    autocad at:
    http://www.davidkblackmon.com/autocad
    B/c coding autocad in .net is very messy.
    My understanding is David took what Kean did in his post and tried
    improve and expand it. Last I tried to get David’s version to work I
    couldn’t. But I knew a lot less then :slight_smile: I am not sure if he is actively
    working on his autocad_helper library or not.

The previous commenters were correct in that there is not many people
interested in this subject yet. I am.

I am constanly working in excel and autocad so I will be glad to answer
any question that I can. If you can give me your version of windows and
your version of Autocad I can probably get you started. From there you
can explore the vast undiscovered potential the 2-3 other people
interested in this subject get to wander in.

Timothy B.

Hello Timothy,

I am very pleased for this information from you. If you give me
your email address i want to talk to you directly.

I am planing to user AutoCAD 2010 or AutoCAD 2011

  • also later ZwCAD 2011 - and I am using Windows 7
    pro 64bit, Micosoft Office XP.

If we will fulfill in this project, i am planing to write a
documantation about this integration in very detail…

Regards,

Murat USTUNTAS

On 03/02/2011 10:40 PM, Timothy B. wrote:

AutoCAD.

couldn’t. But I knew a lot less then :slight_smile: I am not sure if he is actively

Timothy B.

Don’t use the email above. I am having problems with it.

Instead use:

[email protected]

Sorry.

Timothy

Hi,
Timothy is correct. I am not actively working on my gem any longer.
Mainly because there wasn’t much interest.

But I remain convinced that using Ruby to code against the Acad .net API
can be a great way to go.

I haven’t even tried to compile any of my code with the newer versions
of IronRuby or Acad. (It has been over a year since I worked on it)

But I would be willing to try again if there is some interest.

Anyone that is interested can contact me davidkblackmon at gmail DOT
com.

I would love if we could build some interest in using IronRuby with
AutoCad.

Thanks,
David Blackmon

You can email me at:

[email protected]

Timothy

Hello David,

I am happy to hear your noise. I hope that open source
programming languages will be very popular and attractive
for this type of programming (Acad, Office, and others).
So please you refresh and develop your gem…

Regards,

Murat USTUNTAS

On 03/09/2011 03:52 AM, David B. wrote:

But I would be willing to try again if there is some interest.

Murat,

I was successful in getting Excel to talk to AutoCAD. I had to revert
back to IronRuby 0.9.1 b/c IronRuby 1+, so far has been kicked out of
Autocad saying that .NET is too new.

Here is what I used:

Applications:
SharpDevelop 4.0 (b/c I’m new to visual studio)
IronRuby 0.9.1
Autocad 2011
Excel 2007

References:
(AutoCAD Specific) -find these files in C:\Program
Files\Autodesk\AutoCAD 2011 or wherever your program is located at.
acdbmgd.dll
acmgd.dll

IronRuby Libraries -find in Ironruby\bin
IronRuby.dll
IronRuby.Libraries.dll
IronRuby.Libraries.Yaml.dll
Microsoft.Dynamic.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.Debugging.dll

Standard Libraries
System.dll
System.Core.dll
System.Xml.dll
System.Xml.Linq.dll

Code:
AL.cs - C# bridge (build project and type ‘netload’ in AutoCAD to load
resulting .dll file)

xl_2_acad.rb - after you have successfully load ironruby type ‘RBLOAD’ @
AutoCAD command prompt and select this file

xl_2_acad.xlsx - must be at location ‘C:\xl_2_acad.xlsx’ to work or
change ruby script

I have attached the code and excel files that I used. (the ruby code is
literally thrown together) Let me know if your were successful. I will
continue to try and get IronRuby 1+ to work and even possibly the
‘win32ole’ library since I am used to scripting excel with it instead of
the .net methods. Also I will try and get David’s helper methods up and
working.

Timothy

Hi Timothy,

This is very very good news for me… I just try this.
I hope so i will fulfill in your way…

Regards,
Mura USTUNTAS

On 03/30/2011 03:48 AM, Timothy B. wrote:

IronRuby 0.9.1
IronRuby.dll
System.Xml.Linq.dll

Attachments:
http://www.ruby-forum.com/attachment/6089/xl_2_acad.xlsx
http://www.ruby-forum.com/attachment/6090/AL.cs
http://www.ruby-forum.com/attachment/6091/xl_2_acad.rb