Skip to content

Dimension in autocad #78

Description

@lroyer-star

Hello,
Thanks for the great work on this repo.
Today, i'm facing an issue with dxf and dimension.
I tried to write a dxf file with two lines and a dimension by inserting this code in example writer ( https://github.com/rvt/dxfrwtest) :


` virtual void writeEntities()
    {
        DRW_Line line;
        line.basePoint.x = 10;
        line.basePoint.y = 20;
        line.secPoint.x = 30;
        line.secPoint.y = 30;
        dxfW.writeLine( &line );

        DRW_Line line2;
        line2.basePoint.x = 0;
        line2.basePoint.y = 0;
        line2.secPoint.x = 0;
        line2.secPoint.y = 30;
        dxfW.writeLine( &line2 );

    // Create and configure a linear dimension
    DRW_DimAligned dimLinear;
    dimLinear.type = DRW::DIMENSION;
    dimLinear.setStyle( "Standard" );                       // Dimension style
    dimLinear.setDefPoint( DRW_Coord( 10.0, 10.0, 0.0 ) );  // Definition point
    dimLinear.setTextPoint( DRW_Coord( 15.0, 10.0, 0.0 ) ); // Text midpoint
    dimLinear.setDef1Point( DRW_Coord( 10.0, 10, 0 ) );     // Extension line 1 start point x
    dimLinear.setDef2Point( DRW_Coord( 10.0, 20, 0 ) );     // Extension line 1 start point x

    dxfW.writeDimension( &dimLinear );
}`

The file is well generated and can be opened properly in LibreCad, unfortunately, the dxf file seems to be not compatible with autocad. Do I miss something ? please let me know if you have any idea or if you have a writer example that works with autocad and dimension.

I have attached the dxf file ( to .txt here)
file.txt

Thanks again,

Lucas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions