US Paper sizes

Use this forum to ask questions about how to do things in the QCAD Community Edition.

Moderator: andrew

US Paper sizes

Postby hpp3 » Wed Aug 08, 2007 3:38 pm

As I have understood from asking similar questions in other forums, the obvious answer would be to simply use "real" paper sizes. :D

But seriously, it would be nice to have US Architectural and Engineering paper sizes as options, as I am using QCad community edition to draw plans for my deck AND I live in the US.

Is this planned for a future version? Only available in Professional? Is there a way to configure these in?

As it is now, I can set my desired size with the 'Custom' Paper format in Drawing Preferences and it comes out fine when I make a PS file to send to the printers, but having the choice would be nice, and less confusing for american users...

Thanks for your help...
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby tomate » Fri Aug 10, 2007 8:09 am

Hi,
If you know how to compile Qcad, you can edit these two files :
qcad-2.0.5.0-1-community.src/qcadlib/src/engine/rs_units.cpp
qcad-2.0.5.0-1-community.src/qcadlib/src/engine/rs.h
Make a string search for "Tabloid" for example and add your own paper sizes the same way. Then re-compile Qcad.
tomate
Newbie Member
 
Posts: 5
Joined: Wed Jul 18, 2007 8:11 am
Location: France

Postby hpp3 » Fri Sep 07, 2007 9:08 am

I was afraid you were going to say that...

If I knew more about programming, it would be sweet to change the paper size definitions to a function which loaded them from a config file.
Preferably a .rc file in ~/.qcad.

Any takers? :)
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby hpp3 » Mon Feb 18, 2008 8:56 pm

OK, it worked... almost.

If you don't stick the same papersize names in $QTDIR/qprinter.h it says "[papersize] is not a member of qprinter.h".

Now I'm getting the "ISO C++ does not support long long" error.
Looks like someone else found a workaround, I'll post my results later.

If anyone's interested, I'll also post my modified rs_units.cpp and rs.h for good measure...
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby hpp3 » Tue Feb 19, 2008 10:10 am

OK, in ./qcadlib/src/engine/rs.h, add the following code under "Paper formats" (I put mine between 'Executive' and 'A0')
Code: Select all
   AnsiB,
      AnsiC,
      AnsiD,
      AnsiE,
   ArchA,
      ArchB,
      ArchC,
      ArchD,
      ArchE1,
      ArchE,

This same list of sizes separated by commas can be put in $QTDIR/include/qprinter.h under "enum PageSize", though I'm not sure it's necessary.

and in ./qcadlib/src/engine/rs_units.cpp add the following code under "@return Size of the given paper format":
Code: Select all
    case RS2::AnsiB:
   ret = RS_Vector(279.4, 431.8);
   break;
    case RS2::AnsiC:
   ret = RS_Vector(431.8, 558.8);
   break;
    case RS2::AnsiD:
   ret = RS_Vector(558.8, 863.6);
   break;
    case RS2::AnsiE:
   ret = RS_Vector(863.6, 1117.6);
   break;
    case RS2::ArchA:
   ret = RS_Vector(228.6, 304.8);
   break;
    case RS2::ArchB:
   ret = RS_Vector(304.8, 457.2);
   break;
    case RS2::ArchC:
   ret = RS_Vector(457.2, 609.6);
   break;
    case RS2::ArchD:
   ret = RS_Vector(609.6, 914.4);
   break;
    case RS2::ArchE1:
   ret = RS_Vector(762.0, 1066.8);
   break;
    case RS2::ArchE:
   ret = RS_Vector(914.4, 1219.2);
   break;

(once again, between Executive and A0)

and in the same file after "Converts a paper format to a string (e.g. for a combobox)." put this code:
Code: Select all
    case RS2::AnsiB:
        ret = "ANSI B";
        break;
    case RS2::AnsiC:
        ret = "ANSI C";
        break;
    case RS2::AnsiD:
        ret = "ANSI D";
        break;
    case RS2::AnsiE:
        ret = "ANSI E";
        break;
    case RS2::ArchA:
        ret = "Arch A";
        break;
    case RS2::ArchB:
        ret = "Arch B";
        break;
    case RS2::ArchC:
        ret = "Arch C";
        break;
    case RS2::ArchD:
        ret = "Arch D";
        break;
    case RS2::ArchE1:
        ret = "Arch E1";
        break;
    case RS2::ArchE:
        ret = "Arch E";
        break;


and after "converts a string to a paper format"
Code: Select all
    } else if (p=="ansi b") {
        ret = RS2::AnsiB;
    } else if (p=="ansi c") {
        ret = RS2::AnsiC;
    } else if (p=="ansi d") {
        ret = RS2::AnsiD;
    } else if (p=="ansi e") {
        ret = RS2::AnsiE;
    } else if (p=="arch a") {
        ret = RS2::ArchA;
    } else if (p=="arch b") {
        ret = RS2::ArchB;
    } else if (p=="arch c") {
        ret = RS2::ArchC;
    } else if (p=="arch d") {
        ret = RS2::ArchD;
    } else if (p=="arch e1") {
        ret = RS2::ArchE1;
    } else if (p=="arch e") {
        ret = RS2::ArchE;


I hope this helps somebody...

PS: I didn't include ANSI A because it's essentially 'Letter' size in landscape format.
And ANSI B isn't the same as Executive or Ledger.
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby hpp3 » Tue Feb 19, 2008 11:51 am

OK, now I'm stumped.
I built Qcad just fine. It lets me select US paper sizes in the drawing preferences.
But it still lists the default sizes in the print dialog, and I have searched the sources for where the print dialog gets its paper sizes, but I can't find anything.
I am using the CUPS-pdf printer and it has US paper sizes defined in the ppd file, so I don't know what to do from here.
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby hpp3 » Mon Feb 25, 2008 5:39 pm

OK, after a little more digging, it looks like it is purely a QT issue.

I am going to make QCad with a custom compile of QT3 that has relevant changes to "qprinter.cpp"

wish me luck, and I'll post my results if it works...
hpp3
Junior Member
 
Posts: 11
Joined: Tue Jul 17, 2007 4:11 pm

Postby gbburkhardt » Sun May 31, 2009 7:53 pm

These changes worked for me with version 2.0.5.0-1. I changed the qprinter files from Qt 3.3.8b with similar changes, and the printer dialog now presents US paper sizes. One complication is that Ghostscript doesn't support the ANSI sizes, but only the architectural sizes. This is unfortunate since I like to convert the files to PDF before running off to the copy center to get larger size drawings printed.

Files to change are:
qprintdialog.cpp
qprinter.h
qprinter.cpp
qprinter_unix.cpp

I copied these files to "qcadlib/src/engine", and changed the qcadlib/src/qcadlib.pro to include them, and "qprinter_p.h", "qpsprinter_p.h", which also need to be copied to "qcadlib/src/engine", but don't need any changes.

The changes are (unified context diff; copy to a file and use 'patch'):

Code: Select all
--- /usr/src/packages/SOURCES/qt-x11-free-3.3.8b/src/dialogs/qprintdialog.cpp  2008-01-15 14:09:13.000000000 -0500
+++ ./qprintdialog.cpp  2009-05-31 12:07:45.000000000 -0400
@@ -1345,6 +1345,16 @@
     isc( d, tr( "C5E (163 x 229 mm)" ), QPrinter::C5E );
     isc( d, tr( "DLE (110 x 220 mm)" ), QPrinter::DLE );
     isc( d, tr( "Executive (7.5x10 inches, 191x254 mm)" ), QPrinter::Executive );
+    isc( d, tr( "Ansi B (11 x 17 inches, 279.4 x 431.8 mm)"), QPrinter::AnsiB);
+    isc( d, tr( "Ansi C (17 x 22 inches 431.8 x 558.8 mm)"), QPrinter::AnsiC);
+    isc( d, tr( "Ansi D (22 x 34 inches, 558.8 x 863.6 mm)"), QPrinter::AnsiD);
+    isc( d, tr( "Ansi E (34 x 44 inches, 863.6 x 1117.6 mm)"), QPrinter::AnsiE);
+    isc( d, tr( "Arch A (9 x 12 inches, 228.6 x 304.8 mm)"), QPrinter::ArchA);
+    isc( d, tr( "Arch B (12 x 18 inches, 304.8 x 457.2 mm)"), QPrinter::ArchB);
+    isc( d, tr( "Arch C (18 x 24 inches, 457.2 x 609.6 mm)"), QPrinter::ArchC);
+    isc( d, tr( "Arch D (24 x 36 inches, 609.6 x 914.4 mm)"), QPrinter::ArchD);
+    isc( d, tr( "Arch E1 (30 x 42 inches, 762.0 x 1066.8 mm)"), QPrinter::ArchE1);
+    isc( d, tr( "Arch E (36 x 48 inches, 914.4, 1219.2 mm)"), QPrinter::ArchE);
     isc( d, tr( "Folio (210 x 330 mm)" ), QPrinter::Folio );
     isc( d, tr( "Ledger (432 x 279 mm)" ), QPrinter::Ledger );
     isc( d, tr( "Legal (8.5x14 inches, 216x356 mm)" ), QPrinter::Legal );
glenn@DepotRd:~/qcad> cat printer.patch
--- /usr/src/packages/SOURCES/qt-x11-free-3.3.8b/src/dialogs/qprintdialog.cpp  2008-01-15 14:09:13.000000000 -0500
+++ ./qprintdialog.cpp  2009-05-31 12:07:45.000000000 -0400
@@ -1345,6 +1345,16 @@
     isc( d, tr( "C5E (163 x 229 mm)" ), QPrinter::C5E );
     isc( d, tr( "DLE (110 x 220 mm)" ), QPrinter::DLE );
     isc( d, tr( "Executive (7.5x10 inches, 191x254 mm)" ), QPrinter::Executive );
+    isc( d, tr( "Ansi B (11 x 17 inches, 279.4 x 431.8 mm)"), QPrinter::AnsiB);
+    isc( d, tr( "Ansi C (17 x 22 inches 431.8 x 558.8 mm)"), QPrinter::AnsiC);
+    isc( d, tr( "Ansi D (22 x 34 inches, 558.8 x 863.6 mm)"), QPrinter::AnsiD);
+    isc( d, tr( "Ansi E (34 x 44 inches, 863.6 x 1117.6 mm)"), QPrinter::AnsiE);
+    isc( d, tr( "Arch A (9 x 12 inches, 228.6 x 304.8 mm)"), QPrinter::ArchA);
+    isc( d, tr( "Arch B (12 x 18 inches, 304.8 x 457.2 mm)"), QPrinter::ArchB);
+    isc( d, tr( "Arch C (18 x 24 inches, 457.2 x 609.6 mm)"), QPrinter::ArchC);
+    isc( d, tr( "Arch D (24 x 36 inches, 609.6 x 914.4 mm)"), QPrinter::ArchD);
+    isc( d, tr( "Arch E1 (30 x 42 inches, 762.0 x 1066.8 mm)"), QPrinter::ArchE1);
+    isc( d, tr( "Arch E (36 x 48 inches, 914.4, 1219.2 mm)"), QPrinter::ArchE);
     isc( d, tr( "Folio (210 x 330 mm)" ), QPrinter::Folio );
     isc( d, tr( "Ledger (432 x 279 mm)" ), QPrinter::Ledger );
     isc( d, tr( "Legal (8.5x14 inches, 216x356 mm)" ), QPrinter::Legal );
--- /usr/src/packages/SOURCES/qt-x11-free-3.3.8b/src/kernel/qprinter.h  2008-01-15 14:09:13.000000000 -0500
+++ ./qprinter.h        2009-05-31 11:31:34.000000000 -0400
@@ -66,6 +66,8 @@
     enum Orientation { Portrait, Landscape };
 
     enum PageSize    { A4, B5, Letter, Legal, Executive,
+                      AnsiB, AnsiC, AnsiD, AnsiE, ArchA, ArchB,
+                      ArchC, ArchD, ArchE1, ArchE,
                       A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
                       B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
                       DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom };
--- /usr/src/packages/SOURCES/qt-x11-free-3.3.8b/src/kernel/qprinter.cpp       2008-01-15 14:09:13.000000000 -0500
+++ ./qprinter.cpp      2009-05-31 12:13:32.000000000 -0400
@@ -237,6 +237,16 @@
     \value Comm10E 105 x 241 mm, US Common #10 Envelope
     \value DLE 110 x 220 mm
     \value Executive 7.5 x 10 inches, 191 x 254 mm
+    \value AnsiB 11 x 17 inches, 279.4 x 431.8 mm
+    \value AnsiC 17 x 22 inches 431.8 x 558.8 mm
+    \value AnsiD 22 x 34 inches, 558.8 x 863.6 mm
+    \value AnsiE 34 x 44 inches, 863.6 x 1117.6 mm
+    \value ArchA 9 x 12 inches, 228.6 x 304.8 mm
+    \value ArchB 12 x 18 inches, 304.8 x 457.2 mm
+    \value ArchC 18 x 24 inches, 457.2 x 609.6 mm
+    \value ArchD 24 x 36 inches, 609.6 x 914.4 mm
+    \value ArchE1 30 x 42 inches, 762.0 x 1066.8 mm
+    \value ArchE 36 x 48 inches, 914.4, 1219.2 mm
     \value Folio 210 x 330 mm
     \value Ledger 432 x 279 mm
     \value Legal 8.5 x 14 inches, 216 x 356 mm
@@ -973,13 +983,14 @@
 */
 void QPrinter::setPrintRange( PrintRange range )
 {
-    if( range != AllPages )
+    if( range != AllPages ) {
        if( range == Selection
            && !isOptionEnabled( PrintSelection ) )
            setOptionEnabled( PrintSelection, TRUE );
        else if( range == PageRange
                 && !isOptionEnabled( PrintPageRange ) )
            setOptionEnabled( PrintPageRange, TRUE );
+    }
     d->printRange = range;
 }
 
--- /usr/src/packages/SOURCES/qt-x11-free-3.3.8b/src/kernel/qprinter_unix.cpp  2008-01-15 14:09:13.000000000 -0500
+++ ./qprinter_unix.cpp 2009-05-31 11:46:33.000000000 -0400
@@ -300,6 +300,8 @@
 
 static const char * const psToStr[QPrinter::NPageSize+1] =
 { "A4", "B5", "Letter", "Legal", "Executive",
+  "Ansi B", "Ansi C", "Ansi D", "Ansi E", "Arch A", "Arch B",
+  "Arch C", "Arch D", "Arch E1", "Arch E",
   "A0", "A1", "A2", "A3", "A5", "A6", "A7", "A8", "A9", "B0", "B1",
   "B10", "B2", "B3", "B4", "B6", "B7", "B8", "B9", "C5E", "Comm10E",
   "DLE", "Folio", "Ledger", "Tabloid", 0
@@ -493,6 +495,16 @@
     {  IN(8.5), IN(11) },       // Letter
     {  IN(8.5), IN(14) },       // Legal
     {  IN(7.5), IN(10) },       // Executive
+    {  IN(11), IN(17) },       // Ansi B
+    {  IN(17), IN(22) },       // Ansi C
+    {  IN(22), IN(34) },       // Ansi D
+    {  IN(34), IN(44) },       // Ansi E
+    {  IN(9), IN(12) },                // Arch A
+    {  IN(12), IN(18) },       // Arch B
+    {  IN(18), IN(24) },       // Arch C
+    {  IN(24), IN(36) },       // Arch D
+    {  IN(30), IN(42) },       // Arch E1
+    {  IN(36), IN(48) },       // Arch E
     {  MM(841), MM(1189) },     // A0
     {  MM(594), MM(841) },      // A1
     {  MM(420), MM(594) },      // A2
gbburkhardt
Registered Member
 
Posts: 1
Joined: Sun May 31, 2009 7:32 pm
Location: Boston, MA


Return to QCAD Community 'How Do I' Questions

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron