LibreCAD / LibreCAD

LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline primitives. The user interface is highly customizable, and has dozens of translations.
http://librecad.org/
Other
4.48k stars 1.01k forks source link

Feature Request: Add ANSI/Engineering drwing sizes #1140

Closed slackuser0xae34 closed 4 years ago

slackuser0xae34 commented 5 years ago

2019/08/26

Feature Request: Add ANSI/Engineering drawing sizes.

I've created a patch for LibreCAD-2.2.0-alpha. The patch implements the addition of engineering page sizes: ANSI A called Engineering_A, ANSI B called Engineering_B, ANSI C called Engineering_C, ANSI D called Engineering_D, ANSI E called Engineering_E

The following files were edited to implement the engineering paper size request. LibreCAD-2.2.0-rc1/librecad/src/lib/engine/rs.h LibreCAD-2.2.0-rc1/librecad/src/lib/engine/rs_units.cpp LibreCAD-2.2.0-rc1/librecad/src/lib/printing/lc_printing.cpp

Please see the patch for the code details.

Note 1: I've called these sizes "Engineering" rather than "ANSI", as there may be copyright/patent/trademark issues using the name "ANSI".

Note 2: There is an issue with the ANSI sizes due to a QT5 quirk.

IMPORTANT: QT5 has quirks in the code regarding the ANSI paper sizes.

Edit: 2020/02/25: Sorry I forgot, I license the following code under the GPL V2.

 ## Start Patch

 diff -Naur LibreCAD-master/librecad/src/lib/engine/rs.h LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/engine/rs.h
 --- LibreCAD-master/librecad/src/lib/engine/rs.h   2019-06-10 18:34:11.000000000 -0400
 +++ LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/engine/rs.h 2019-08-23      19:57:38.100067780 -0400
 @@ -913,7 +913,11 @@
          Arch_E1,
          Arch_E2,
          Arch_E3,
 -
 +        Eng_A,
 +        Eng_B,
 +        Eng_C,
 +        Eng_D,
 +        Eng_E,
             NPageSize
     };

 diff -Naur LibreCAD-master/librecad/src/lib/engine/rs_units.cpp LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/engine/rs_units.cpp
 --- LibreCAD-master/librecad/src/lib/engine/rs_units.cpp   2019-06-10 18:34:11.000000000 -0400
 +++ LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/engine/rs_units.cpp 2019-08-23 19:58:49.978069705 -0400
 @@ -977,6 +977,17 @@
 case RS2::Arch_E3:
 return RS_Vector(686.,991.);

 +    case RS2::Eng_A:
 +    return RS_Vector(279.4,215.9);
 +    case RS2::Eng_B:
 +    return RS_Vector(431.8,279.4);
 +    case RS2::Eng_C:
 +    return RS_Vector(558.8,431.8);
 +    case RS2::Eng_D:
 +    return RS_Vector(863.6,558.8);
 +    case RS2::Eng_E:
 +    return RS_Vector(1117.6,863.6);
 +
 case RS2::NPageSize:
     return RS_Vector(0.0, 0.0);
     break;
 @@ -1163,6 +1174,17 @@
      case RS2::Arch_E3:
      return QString("Arch E3");

 +    case RS2::Eng_A:
 +    return QString("Eng A");
 +    case RS2::Eng_B:
 +    return QString("Eng B");
 +    case RS2::Eng_C:
 +    return QString("Eng C");
 +    case RS2::Eng_D:
 +    return QString("Eng D");
 +    case RS2::Eng_E:
 +    return QString("Eng E");
 +
      case RS2::NPageSize:
          ret = "NPageSize";
          break;
 @@ -1278,6 +1300,12 @@
      if (p==QString("Arch E2")) return RS2::Arch_E2;
      if (p==QString("Arch E3")) return RS2::Arch_E3;

 +    if (p==QString("Eng A")) return RS2::Eng_A;
 +    if (p==QString("Eng B")) return RS2::Eng_B;
 +    if (p==QString("Eng C")) return RS2::Eng_C;
 +    if (p==QString("Eng D")) return RS2::Eng_D;
 +    if (p==QString("Eng E")) return RS2::Eng_E;
 +
      if (p=="npagesize") return RS2::NPageSize;

      return ret;
 diff -Naur LibreCAD-master/librecad/src/lib/printing/lc_printing.cpp LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/printing/lc_printing.cpp
 --- LibreCAD-master/librecad/src/lib/printing/lc_printing.cpp  2019-06-10 18:34:11.000000000 -0400
 +++ LibreCAD-2.2.0.2-alpha-master/librecad/src/lib/printing/lc_printing.cpp    2019-08-23 19:59:24.832070638 -0400
 @@ -102,6 +102,16 @@
               return QPrinter::ArchD;
           case RS2::Arch_E:
               return QPrinter::ArchE;
 +         case RS2::Eng_A:
 +             return QPrinter::AnsiA;
 +         case RS2::Eng_B:
 +             return QPrinter::Tabloid;
 +         case RS2::Eng_C:
 +             return QPrinter::AnsiC;
 +         case RS2::Eng_D:
 +             return QPrinter::AnsiD;
 +         case RS2::Eng_E:
 +             return QPrinter::AnsiE;
          #endif
          case RS2::NPageSize:
              return QPrinter::NPageSize;
 diff -Naur LibreCAD-master/librecad/src/src.pro LibreCAD-2.2.0.2-alpha-master/librecad/src/src.pro
 --- LibreCAD-master/librecad/src/src.pro   2019-06-10 18:34:11.000000000 -0400
 +++ LibreCAD-2.2.0.2-alpha-master/librecad/src/src.pro 2019-08-22 15:11:13.000000000 -0400
 @@ -10,7 +10,7 @@
  DEFINES += DWGSUPPORT
  DEFINES -= JWW_WRITE_SUPPORT

 -LC_VERSION="2.2.0-alpha"
 +LC_VERSION="2.2.0.2-alpha"
  VERSION=$${LC_VERSION}

  # Store intermedia stuff somewhere else

 ## End Patch

Sorry, I can't upload either a separate zip or separate text file with the patch in it. The up-loader keeps claiming "Something went really wrong, and we can't process that file".

slackuser0xae34 commented 5 years ago

This patch was created to support U. S. base users. In that spirit I've also created some U. S. engineering drawing borders, some U. S. traditional electronic symbols in dxf format. Further, included are user manual documents for the provided files, in PDF. Although not mentioned on the web page, the patch files for LC 2.1.3 and LC 2.2.0-alpha are included in the zip file.

Everything is in the zip file downloadable from the web page.

The borders, symbols and documents are released under the CC0 license. The symbols are U. S. traditional, not the current ISO symbols. Many of us are more comfortable with the older symbols, for personal use at least.

Link to borders & symbols page: https://archive.org/details/eng_border-ustraditionalqsymbols

Thanks all, slackuser0xae34

slackuser0xae34 commented 4 years ago

Thanks, all. 1229 is what was needed to close this issue.