Inputting Line with specified length (Ortho)

Next Topic
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Inputting Line with specified length (Ortho)

Is there a way that LibreCAD line inputting the same way as AutoCAD does, as it seems a lot quicker with that method than LibreCAD's slow method of entering line length.

Example as per this link

So you get the idea?  Any tips, please?  If there is an add-on or extension that does that, can you please point me to this link?

Many thanks ever so much.   (I'm a newbie to LibreCAD and liking it more).

Reply | Threaded
Open this post in threaded view

Re: Inputting Line with specified length (Ortho)

When I dared to try ChatGPT to create a Qt code in an attempt to perform as per above subject.  Here is the code:

#include <QtWidgets>

class LineLengthDialog : public QDialog

    explicit LineLengthDialog(QWidget *parent = nullptr)
        : QDialog(parent)
        // Create the line edit widget
        lineEdit = new QLineEdit(this);

        // Create the OK and Cancel buttons
        QPushButton *okButton = new QPushButton("OK", this);
        QPushButton *cancelButton = new QPushButton("Cancel", this);

        // Create the layout
        QHBoxLayout *layout = new QHBoxLayout;

        // Set the layout for the dialog

        // Connect the button signals to slots
        connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
        connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);

        setWindowTitle("Enter Line Length");

    QString getLineLength()
        return lineEdit->text();

    QLineEdit *lineEdit;

int main(int argc, char *argv[])
    QApplication app(argc, argv);

    LineLengthDialog dialog;
    if (dialog.exec() == QDialog::Accepted) {
        QString lineLength = dialog.getLineLength();
        // Use the entered line length as needed
        qDebug() << "Line length entered: " << lineLength;

    return app.exec();

#include "main.moc"

Then ChatGPT says the following comments:

This code creates a custom dialog (LineLengthDialog) with a line edit (QLineEdit) for the user to enter the line length. It also includes OK and Cancel buttons. When the user clicks the OK button, the entered line length is retrieved from the line edit and can be used as needed.

Please note that this is just a basic example, and you may need to adapt it to integrate with LibreCAD based on your specific requirements.

++ END

No Idea whether this would work or not as I'm no expert on Qt programming.  Anyone out there to try it out or is ChatGPT unreliable?