From ddc2afa427ab52c6d8656a85b00904aa42416d71 Mon Sep 17 00:00:00 2001 From: David Varley Date: Sun, 16 Aug 2020 15:39:20 +1000 Subject: [PATCH] Fix dxf export for border --- sources/bordertitleblock.cpp | 24 ++++++++++++------------ sources/exportdialog.cpp | 4 +++- sources/titleblocktemplate.cpp | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index a416140bd..8724bbac2 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -652,11 +652,11 @@ void BorderTitleBlock::drawDxf( if (display_border_ && display_columns_) { for (int i = 1 ; i <= columns_count_ ; ++ i) { - double xCoord = diagram_rect_.topLeft().x() + + double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale + (rows_header_width_ + ((i - 1) * columns_width_)); double yCoord = Createdxf::sheetHeight - - diagram_rect_.topLeft().y() + - diagram_rect_.topLeft().y()*Createdxf::yScale - columns_header_height_; double recWidth = columns_width_; double recHeight = columns_header_height_; @@ -665,27 +665,27 @@ void BorderTitleBlock::drawDxf( if (settings.value("border-columns_0", true).toBool()){ Createdxf::drawTextAligned(file_path, QString::number(i - 1), - xCoord, - yCoord + recHeight*0.5, + xCoord+recWidth/4, + yCoord + recHeight*0.2, recHeight*0.7, 0, 0, 1, 2, - xCoord+recWidth/2, + xCoord+recWidth/2, color, 0); }else{ Createdxf::drawTextAligned(file_path, QString::number(i), - xCoord, - yCoord + recHeight*0.5, + xCoord+recWidth/4, + yCoord + recHeight*0.2, recHeight*0.7, 0, 0, 1, 2, - xCoord+recWidth/2, + xCoord+recWidth/2, color, 0); } @@ -699,8 +699,8 @@ void BorderTitleBlock::drawDxf( for (int i = 1 ; i <= rows_count_ ; ++ i) { double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale; - double yCoord = Createdxf::sheetHeight - - diagram_rect_.topLeft().y() + double yCoord = Createdxf::sheetHeight + - diagram_rect_.topLeft().y() *Createdxf::yScale - ( columns_header_height_ @@ -713,8 +713,8 @@ void BorderTitleBlock::drawDxf( recWidth, recHeight, color); Createdxf::drawTextAligned(file_path, row_string, - xCoord, - yCoord + recHeight*0.5, + xCoord+recWidth*0.1, + yCoord + recHeight*0.4, recWidth*0.7, 0, 0, diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index b5db3ccfa..09cfc997e 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -412,7 +412,9 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee //Add project elements (lines, rectangles, circles, texts) to dxf file if (epw -> exportProperties().draw_border) { - Createdxf::drawRectangle(file_path, 0, 0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0); + double bx0 = Diagram::margin * Createdxf::xScale; + double by0 = Diagram::margin * Createdxf::yScale; + Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0); } diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0); diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 85e2f8b86..2117c9e0c 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -1528,7 +1528,7 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect, QList widths = columnsWidth(titleblock_width); // draw the titleblock border - double xCoord = title_block_rect.topLeft().x(); + double xCoord = title_block_rect.topLeft().x()*Createdxf::xScale; double yCoord = Createdxf::sheetHeight - title_block_rect.bottomLeft().y()