Page 1 of 1

Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Mon Jun 08, 2020 7:46 pm
by Tango
This is a followup to my other recent question (https://qcad.org/rsforum/viewtopic.php?f=32&t=7322)

Here is a drawing I did to scale:
Screen Shot 2020-06-08 at 2.39.24 PM.png
Screen Shot 2020-06-08 at 2.39.24 PM.png (44.25 KiB) Viewed 1027 times
To get it to fit on my details page for when I submit it to the county's Plan Review, I needed to enlarge it so it was easy to read, and got this:
Screen Shot 2020-06-08 at 2.39.46 PM.png
Screen Shot 2020-06-08 at 2.39.46 PM.png (68.47 KiB) Viewed 1027 times
I know the 2nd image is too busy, that'll change in clean-up.

My concern is that when I enlarge the drawing, the dimension measurements scale up. Is there any way to enlarge a drawing and keep the measurements the same? Or to change the measurements so they show the original size?

Or is what I'm asking an issue with the integrity of the program and something CAD programs are not supposed to do?

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Mon Jun 08, 2020 7:58 pm
by CVH
Unless you want to make a larger version of a miniature.
What is the reason to scale up the real world measuments of the design?

How we present this on paper has nothing do do with the drawing but with paper scale.

Regards,
CVH

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Mon Jun 08, 2020 8:01 pm
by andrew
Tango wrote:
Mon Jun 08, 2020 7:46 pm
Is there any way to enlarge a drawing and keep the measurements the same?
Yes, for example by using a viewport:
https://qcad.org/en/tutorial-working-wi ... -viewports

Or simply by printing to scale (e.g. 2:1):
https://qcad.org/en/tutorial-printing
Or to change the measurements so they show the original size?
That's also possible using the linear factor property of dimensions:
Select the dimension entity and change the property "Linear factor".
Or is what I'm asking an issue with the integrity of the program and something CAD programs are not supposed to do?
Ideally, try to keep all geometry 1:1 and only scale for printing. If you need different scales in one printout, you can use layout blocks and viewports (see tutorial linked above).

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Tue Jun 09, 2020 1:08 am
by Tango
andrew wrote:
Mon Jun 08, 2020 8:01 pm
Tango wrote:
Mon Jun 08, 2020 7:46 pm
Is there any way to enlarge a drawing and keep the measurements the same?
Yes, for example by using a viewport:
https://qcad.org/en/tutorial-working-wi ... -viewports
Wow! I had no idea this could be done at all! (Hey, when you're self-taught and most of your time with a program is on, "I have to get this done by deadline," you don't always have time to poke around and learn the cool stuff.)
andrew wrote: Or simply by printing to scale (e.g. 2:1):
https://qcad.org/en/tutorial-printing
I've been using that already - after looking over viewports, and realizing there's so much I don't know, maybe my methods are really kludges, but I've been printing different pages to different scales, depending on the width of what I'm fitting on the page.
andrew wrote:
Tango wrote:Or is what I'm asking an issue with the integrity of the program and something CAD programs are not supposed to do?
Ideally, try to keep all geometry 1:1 and only scale for printing. If you need different scales in one printout, you can use layout blocks and viewports (see tutorial linked above).
Yes, as I said, just found out, but once I get the feel for that, I know it's going to make things much easier for me! I would really like to keep things on a 1:1 scale, since, if I don't, and have to make changes, I have to resize to the original size, make changes, then resize again. That leaves room for a lot of mistakes along the way.

Is thread (https://qcad.org/rsforum/viewtopic.php?p=25422) up to date in terms of printing multiple layouts? I would think that I could do it from the command line on macOS the same way it works on Linux, since both command lines are using bash (well, in many cases, they are).

Is there any way to print multiple layouts from the GUI without going through and printing each layout separately?

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Tue Jun 09, 2020 7:45 am
by andrew
Is thread (https://qcad.org/rsforum/viewtopic.php?p=25422) up to date in terms of printing multiple layouts?
Yes. If you are comfortable working with the Terminal, that might be an option.
Is there any way to print multiple layouts from the GUI without going through and printing each layout separately?
No, unfortunately not.

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Wed Jun 10, 2020 9:05 am
by Tango
Just started looking at the JavaScript API and scripting information.

Would it be possible to write a plugin that would let you store the desired order of Layouts in a project within the project file, then, when called, print them all in order (or use that same order to create a PDF document with all the layouts as separate pages)?

Asking first to find out if it's possible. I don't mind putting in the time if it can be done, but I don't want to spend a few hours researching the API right now if it's not doable.

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Thu Jun 11, 2020 8:34 am
by andrew
Layouts (layout blocks) already have an order. You can see / edit it when renaming a layout block.

Yes, this is certainly possible. Below is some rough code. You'd still have to do the block iteration and decide how / if you want to auto fit to paper, etc.

Code: Select all

include("scripts/library.js")

var storage = new RMemoryStorage();
var spatialIndex = createSpatialIndex();
var doc = new RDocument(storage, spatialIndex);
var di = new RDocumentInterface(doc);
var scene = new RGraphicsSceneQt(di);
var view = new RGraphicsViewImage();
view.setScene(scene, false);

// load file:
di.importFile("file.dxf");

var p = new Print(undefined, doc, view);
var printer = p.createPrinter(pdfFile, printerName, pdfVersion);
var painter = new QPainter();
if (painter.begin(printer)) {
    // iterate through layout blocks:
    for (...) {
        var blockName = ...;
        var block = doc.queryBlockDirect(blockName);
        if (block.hasLayout()) {
            var layoutName = block.getLayoutName();
            var layout = doc.queryLayout(layoutName);
            qDebug("exporting layout: %1".arg(layoutName);
        }

        if (i!==0) {
            printer.newPage();
        }

        var blockId = doc.getBlockIdAuto(blockName);
        if (blockId!==RObject.INVALID_ID) {
            var entityIds = doc.queryBlockEntities(blockId);
            if (entityIds.length===0) {
                // skip emtpy block:
                continue;
            }

            doc.setCurrentBlock(blockId);
        }

        p.printCurrentBlock(printer, painter);
    }
}
painter.end();
printer.destroy();

Re: Keeping Dimension Measurements the Same When Resizing Drawings

Posted: Sat Jun 13, 2020 8:01 am
by Tango
Thank you!

I'm working in spurts - I get a day or two to work on my plans for our renovation projects and on things like this, then a while when I can't touch it, so I'll be working on this, but it'll be a while until I can finish it.

I did try this form the command line and it worked fine. It's just easier to do it from within the GUI, so I don't have to leave my work environment to convert to PDF.

One thought occurred to me: Is it possible to run a command line script from QCAD? That might be a simple intermediate step: Call my command line script from within QCAD and it prints. Long term I'd do more to allow for configuration and so on, but this would be a simple way to do it in the mean while.