Wednesday, October 15, 2008

Scripting Support

On the Wildcat support forum we recently got a request to add support for the Lua scripting langauge.  If you have used Wildcat you know that currently no scripting languages are supported.  This is more an issue of having higher priorities than a lack of desire.  I am focused on getting the core modeling kernel up and running and Dan is working hard on the wx port and his own work.

I must admit that I have little background in scripting languages and have never embedded an scripting engine into any of my projects.  I fully understand the value of this and look forward to adding support in Wildcat.

To me the two crucial questions are:
  1. What scripting languages make sense to support?  There are so many possible languages out there that we can't possibly support them all.  Which ones do you all want?
  2. How can we make supporting a large set of scripting languages as easy as possible within the kernel?  I want to make it simple and straightforward to add support for a new language if someone want it.
The Lua requester has asked if we have object model documentation of Wildcat.  The simple answer is "No."  But, I have created a Doxygen configuration file that will generate a lot of very nice documentation automatically.  You can find this file in the source tree at "truck\Documentation\Developer\Doxyfile".  You may have to slightly edit some of the paths to account for your directory structure, but with this you can easily get object models and nice code docs.

Please let me know what else you need in order to try to add scripting to Wildcat.  I am more than happy to add in a Cocoa "script" window etc.  I am we can convince Dan to do this on WX also.

Cheers,
   Graham

5 comments:

khiraly said...

I really like how inkscape solves this. It pass the whole document to the script and read back what the script outputs (to the standard output).

This approaches has advantages:
- no specific requirements for scripting language
- inkscape comes with his packaged python interpreter

And disadvantage:
- cant be really integrated
- large documents needs time to process each time.

In my opinion python is the best solution. It is largely supported and has a huge userbase (your potential contributors). But you should'nt restrict to a specific language. (inkscape way)


But for now please forgot about all the fancy stuff, just make sure that file open/save and booleans operations works to be able to build some userbase. Because wildcat (in his current state) not usable for real work.

You are so close, just one step away to provide a *usable* software. (where you can model some basic stuff and save it. And later open it to modify).

Please concentrate for this vital solution before even thinking about all the fancy stuff.

Khiraly

khiraly said...

this vital solution ->
this vital feature

Sorry for the typo.

greenarrow said...

Embedding Python in C++ is very simple. I've never embedded Lua but I expect it is a very similar and equally simple process

(strangely I was making a C++ module to allow Lua to embed Python indirectly).

Both Lua and Python are great for embedding in programs, I see the benefit of using Lua is that it's a 21st century (i.e. more powerful) version of BASIC so is very easy for people to pick up.

Python on the other hand is probably more powerful and has a large user base?

I expect the APIs for embedding will be very similar so embedding both probably wouldn't be that much harder.

GrahamH said...

After taking a quick look at both the Lua and Python embedding documentation, it seems that both are pretty easy to embed.

The interesting part comes in wrapping existing Wildcat methods so they can be access from each scripting environment. I don't see any way around having separate wrappers for each different scripting language.

I am pretty busy with the kernel code at the moment (Booleans and all), but if I have some time I will see about trying to add some basic support for one of these languages.

If anyone else wants to try please let me know how I can help.

Dan Heeks said...

I agree that Python is good. I have imbedded Python in my CAD/CAM software "HeeksCNC", download it here: http://code.google.com/p/heekscnc/