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.
|
In reply to this post by emanuel
Yes, I think I fully understand all challenges exposing LC internals for scripting...
Actually, that was the reason for my point - most probably, it will be necessary to create a specific sub-set API for scripting only (instead trying to feed existing one to SWIG). As far as I can imagine, roughly such API may include something like this: 1) Scriptable proxies for entities / entity-properties modification functions 2) Utility functions (like support of undo/redo, moving relative points, invoking actions etc.) 3) Existing command scripting 4) Entities selection/catching (by id, by positions etc.) 5) Geometry utilities (selection, intersection, tangent, distance, angle etc.). The major challenge for designing such API is achieving a balance between simplicity of scripting and features set (I still think that exposing existing object model "as is" will be more than complex for scripting)... |
Well, done...
My mom bought her son a hard drive/new case/nvme hat for Christmas :-). The installation into the Raspberry pi5 turned out to be a bit difficult, thanks to my 55-year-old eyesight. Mini screws and they kept flying around and wouldn't go into the hole. So that it didn't get boring, a pin (approx. 1/3 mm) was bent. Thanks to a magnifying glass and glasses, I managed it the second time. Setting up the OS was just as nice. But after a day's work, QtCreator went again. And now like a rocket^· I then immediately tried to build an AppImage. That didn't work. I'll have to try it out and read up on it first. I haven't built my own yet. And now I'm currently working from home for the building authority :-). I hope you had a nice Christmas. |
This post was updated on .
So,
I adapted the script. Now it builds me an AppImage, which also starts in my 24 Ubuntu aarch, unfortunately it doesn't start on the original Rasbian64 (pi Os) because the libc6 there is 2.36, but the AppImage is built with 2.38. I'll have to take another look to see if I can adjust it. |
works on raspbian to, but I have to buid it there...
build-appimg-new-v2.zip |
Free forum by Nabble | Edit this page |