At the moment I have a workaround:
https://github.com/emanuel4you/LibreCAD/blob/developer/librecad/src/lib/scripting/rs_lsp_inputhandle.cpp but I can't get any further with that here: https://github.com/emanuel4you/LibreCAD/blob/developer/librecad/src/lib/scripting/rs_scriptingapi.cpp#L381 https://github.com/emanuel4you/LibreCAD/blob/developer/librecad/src/lib/scripting/rs_scriptingapi.cpp#L460 In both commands the user must have the option of entering the results via the command line. (getdistance <-- "100" return) This works with the existing actions but only with points, as far as I can see. Everything else is entered via dialogs. (text, mtext, rotate, attributes, ...) Now I'm thinking about how and where I can best incorporate this. While searching, I also came across the "rotate" command. I can't seem to get to grips with it. I couldn't enter an angle at all. Here, too, I would like the option of simply entering the angle in the command line. I've drawn countless floor plans in my life and suffered physical injuries as a result (hands, spine). Something like this is essential for effective drawing (being able to avoid clicks and dialogs wherever possible for the sake of accessibility). What I noticed: I modified a polyline (arc). It then had a hole between the arc and the last segment. |
hm... no sure how that might be addressed right now.
Actually, it's responsibility of the action to handle user's input according to the current actions' state. State is important, since, for example, coordinates input in different states may mean complete different things (think about start/end point of the line). Therefore, the only way to support processing is just expand actions and ensure that they are fully controlled via cmd line. I've planned to review cmd support later, so that will be revised, of course. From the other side - I'm really not sure that this is promising idea to rely on the current actions implementations. Of course, it may deliver some shortcuts, but in longer prospecteve - will be deliver maintenance and support hell. For sure, it might be that some useful logic currently is incorporated directly into actions, but even if it so - it's more practical to identify it and move to some reusable code (that might be used both by actions and scripting). Just to illustrate the above: Consider "rotate" action. There are lot's of code for handling user's input, generation of preview, controlling states, mouse etc. Obviously, all that code is not relevant for the scripting. For the scripting view - you just have to provide the user with possibility to gather necessary parameters (like rotation angle), select entities (here I'm really not sure how to select particular entities via scripting) - and invoke rotate operation. All this logic may be completely decoupled from actions and be performed on scripting part, of course. However, the actual process of modification (i.e. rotation) is quite universal - and it may be extracted to something like src/lib/modification/RS_Modification.h (as well src/lib/modification/RS_Creation etc). Please take a look to them - probably methods from there will be helpful for your purposes. P.S > What I noticed: I modified a polyline (arc). > It then had a hole between the arc and the last segment. Could you please expand on reproducing this and share a sample DXF with such behavior? P.P.S there are includes like #include "intern/qc_actiongetpoint.h" #include "intern/qc_actiongetcorner.h" #include "intern/qc_actionentsel.h" But it seems that there is no "intern" directory, please make sure that you didn't forget to commit it too. |
Sorry for the late reply.
I've caught a bad cold. I've recorded the polyline. I don't know it from AutoCAD. (attached) "But it seems that there is no "intern" directory, please make sure that you didn't forget to commit it too.st engineered." >> I don't understand, it's always been there: https://github.com/LibreCAD/LibreCAD/tree/master/librecad/src/plugins/intern or in my case: https://github.com/emanuel4you/LibreCAD/blob/developer/librecad/src/plugins/intern/qc_actionentsel.h I've already looked at the control of the actions. I also need preview etc. in the script commands, but often in other combinations like those used in the LC API. But that's the same in AutoCAD. The script commands are more like a construction kit. I just want to stick to the AutoLisp guidelines, like BriscCad, IntelliCAD, etc. do, to remain as compatible as possible. I'll continue to approach it carefully. I already have a basic idea. But first I need to get really healthy... simplescreenrecorder-2025-02-11_13.mp4 pline.dxf |
oh, thank you for screen recording for polyline and sample dxf - I'll definitely take a look.
> I've already looked at the control of the actions. I also need preview etc. in the script commands, but often in other combinations like those used in the LC API. Well... for sure, that' possible to display custom previews from scripts - with introduction of appropriate methods to scripting. But in such case it may require custom support of preview/highlights in scripts with explicit call of such preview methods. That might be quite complicated for the script writers. As you can see, the logic of preview for some actions is quite complex, and sometimes requires additional computations just to show preview-related informational entities. > But first I need to get really healthy... Oh, sorry to hear that. Which you a speedy recovery! |
Free forum by Nabble | Edit this page |