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
Luca,

we should be using libdxfrw Rallaz can help you with that.

When I quickly grep the source code I see classes for MTEXT and TEXT (line 443 of drw_entities.h)

Ries



On Apr 17, 2012, at 8:03 AM, gnagno91 [via LibreCAD] wrote:

Hi!
The reader support for TEXT entity should be added in the package dxflib, too or only in libdxrw?

Luca


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/dxf-library-reader-tp5646518p5646518.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML

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);