Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to read .NC1 file (.nc1file) from QT ?



  • Im trying to read .NC1 file (.nc1file) from QT but didnt get any result
    can anyone help me in this.

    An NC1 file is a numerical control file created by Mastercam, a suite of CAD programs used for designing and manufacturing components. It contains instructions for directing a machine tool, such as a laser cutter, nester, welder, or drill, during production.

    System Details
    windows 10 pro
    64bit

    Qt Details
    Desktop qt 5.5.0 MinGw 32bit



  • thanks @jsulm and @LeLev

    I reading a file as normal reading file like .pdf or .ini and got data which i want.
    following code is working for me.

    QString filename="8VB202.nc1";
    QFile file(filename);
    if(!file.exists()){
        qDebug() << "->file exists  "<<filename;
    }else{
        qDebug() << filename<<"->file not exists";
    }
    ui->textBrowser->clear();
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)){
        QTextStream stream(&file);
        ui->textBrowser->setText(stream.readAll());
        }
    file.close(); 
    

    output of file
    Screenshot_1.png

    once again thank you


  • Qt Champions 2019

    @Pranit-Patil said in How to read .NC1 file (.nc1file) from QT ?:

    but didnt get any result

    What did you do? What did not work?
    I don't think Qt supports this format, you will need either to implement your own parser or search for a library.



  • @Pranit-Patil isn't it plain text file ? ISO 6983
    Reading it is simple using QFile
    What you want to do after reading ?



  • thanks @jsulm and @LeLev

    I reading a file as normal reading file like .pdf or .ini and got data which i want.
    following code is working for me.

    QString filename="8VB202.nc1";
    QFile file(filename);
    if(!file.exists()){
        qDebug() << "->file exists  "<<filename;
    }else{
        qDebug() << filename<<"->file not exists";
    }
    ui->textBrowser->clear();
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)){
        QTextStream stream(&file);
        ui->textBrowser->setText(stream.readAll());
        }
    file.close(); 
    

    output of file
    Screenshot_1.png

    once again thank you


Log in to reply