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?
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?
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.
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:
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.
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 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.
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.
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
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.