So, here are a few 'LibreCAD Test apps' running in Lisp and Python with Dcl (Dialog Control Language).
I've already made quite a bit of progress in the Gui (it's probably over 2000 hours already) Oh my God! - but I still have fun :-). Unfortunately, I'm not that deep into the LibreCAD source yet, but I can send an input with mouse... https://www.youtube.com/watch?v=c0555_2KwmM If you look closely, you'll see me shooting the LibreCAD with a zombie script residue at the end of the video. (In the background there is still gui, which I overwrite in the LibreLisp Ide editor, restart and then shoot everyone with the dialog Quit Button. Yes, scripts can be bad! But that doesn't happen when a finished app is used later :-). Have fun watching... Kind regards Emanuel |
Hi Emanuel,
Oh, this is more than promising indeed - I see there is great progress there. Support of DCL is impressive indeed! I'm wondering there you have some ideas how existing functionality of LibreCAD may be invoked from scripts. Of course, it's possible just invoke commands (I've noticed that at the beginning of your clip you've invoked the set of commands to draw a smile) - yet I suppose that commands only might be not enough. For example - there are such operations as undo/redo, selecting/search specific entities using various conditions, geometry functions (like finding intersections, tangents or so) - and probably it will be necessary to introduce some additional API layer that will be available from scripting. I'm not sure that direct 1:1 wrapping of, for example, entities, will be promising approach, as there are lots of internal methods and properties which are not always useful for direct usage in script. Actually, creation of such API may be another quite significant task, therefore if you have some ideas regarding that area - please share them too. Thank you. |
My first goal is to embed the two interpreters and the Dcl script language stably with as little intervention as possible.
I still have problems with the simplest LC commands :-D. Speaking of commands. At the beginning of the video the smiley is drawn with the Lisp command "Command", which can simply execute command line commands like in AutoCAD. I did the user input with src in a similar way to the LibreCAD plugin class. Unfortunately, of course, only keyboard input in the original command line works. The Lisp command line is still blocked. This is all still very proto. I've been trying to port the entire object model to Python for a long time (I have to install it all myself for Lisp anyway - or gain experience with the object model), and I've already gotten a lot across with swig. (see file attached) Unfortunately, there are still a few problem children among them, such as RS_Settings. This is a QObject class. In order to be able to port something like that, I have to port half of Qtbase. I don't know yet whether this works with swig. QtPy itself uses shiboken for porting. Freecad uses both swig and shiboken. Let's see, I'll approach it carefully. I would prefer it with swig, I know that. And all the DCL stuff I wrote myself works great too. The nice thing about LibreCAD is that it starts as a binary file. I believe FreeCAD starts itself as a Python script. You had something like that with Lua too. I have been developing software for satellite/... receivers for around 20 years, hence my experience in this area (interpreters). The huge disadvantage of "I start myself as a Python script" is that you have to restart the entire application every time you develop the script in order to test the changes in the script. This takes... With LibreCAD I can simply reload the script n times in the IDE using the Run button. That's definitely 10 times faster. And if an error occurs in the script, it is only reported to the console. With the “I am a Python Script” method, it kills the entire app. It's bad if a drawing wasn't saved. Unless you do something bad like I did in the video^^ Merry Christmas to all of you and a happy new year 2025. Best regards Emanuel librecad.zip |
Congratulations on your progress, even though I don't have enough time to gather enough understanding to help.
Do you expect any blockers before merging to the official branch? I remember last time we talked about CI, i.e. building for Linux(appimage, snap), macos, and windows 64.
|
Free forum by Nabble | Edit this page |