dxf library reader

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

dxf library reader

gnagno91
This post was updated on .
Hi!
To add the read support for TEXT should I modify the libdxfrw package, right? in dxflib there are only the function to rea from a file which are used in libdxfrw package?

Luca
Reply | Threaded
Open this post in threaded view
|

Re: dxf library reader

R. van Twisk
Administrator
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: dxf library reader

Rallaz
Hi,
Both libraries have support for read and write TEXT & MTEXT.

to read TEXT with dxflib see rs_filterdxf.cpp line #560
void RS_FilterDXF::addText(const DL_TextData& data)

to write TEXT with dxflib seers_filterdxf.cpp line #1551
void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e, const DL_Attributes& attrib)

to read TEXT with libdxfrw see rs_filterdxfrw.cpp line #531
void RS_FilterDXFRW::addText(const DRW_Text& data)

to write TEXT with libdxfrw see rs_filterdxfrw.cpp line #1737
void RS_FilterDXFRW::writeEntity(RS_Entity* e)


Reply | Threaded
Open this post in threaded view
|

Re: dxf library reader

gnagno91
I looked to the the references you listed. I saw that in rs_filterdxfrw.cpp at the end of void RS_FilterDXFRW::writeInsert (line #1900) there is the call to the writeMText of the dxfRW class. Should I also implement the writeMText in rs_filterdxfrw.cpp, right? Sorry for my sometimes stupid question but I want to be sure of what I will do to not waste time.

Thank you a lot,

Luca
Reply | Threaded
Open this post in threaded view
|

Re: dxf library reader

Rallaz
The line number have changed with my last commits and have started the write part for you.
rs_filerdxfrw.cpp line #1602 say:

    case RS2::EntityInsert:
        writeInsert((RS_Insert*)e);
        break;
    case RS2::EntityText:
        writeMText((RS_Text*)e);
        break;
/*    case RS2::EntityMText:
        writeMText((RS_MText*)e);
        break;*/
    case RS2::EntityDimLinear:

change to:

    case RS2::EntityInsert:
        writeInsert((RS_Insert*)e);
        break;
    case RS2::EntityText: //the e->rtti() type of single line text
        writeText((RS_Text*)e); //function to implement call with the "single line class"
        break;
    case RS2::EntityMText: //the e->rtti()type of multi-line text
        writeMText((RS_MText*)e); //existing function call with the "multi-line class"
        break;
    case RS2::EntityDimLinear:


rs_filerdxfrw.h line #128 say:

    void writeSpline(RS_Spline* s);
    void writeInsert(RS_Insert* i);
//    void writeText(RS_Text* t);
    void writeMText(RS_Text* t);
    void writeHatch(RS_Hatch* h);

change to:

    void writeSpline(RS_Spline* s);
    void writeInsert(RS_Insert* i);
    void writeText(RS_Text* t); //function to implement call with the "single line class"
    void writeMText(RS_MText* t); //existing function call with the "multi-line class"
    void writeHatch(RS_Hatch* h);