[solved] Reloading Hatches without restarting QCAD

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

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

[solved] Reloading Hatches without restarting QCAD

Post by John Hyslop » Mon Aug 24, 2020 2:28 am

Hi All
Does anyone know of a way to reload Hatches
Without having to restart QCAD.
Example updating and testing a perticalar hatch
To see changes without restarting.
AutoCAD automatically updates if hatch is changed..
Looking for "if possible" :-
A script?
A command that can be typed into command prompt..

Any help appreciated

Cheers
John
Last edited by John Hyslop on Sun Aug 30, 2020 6:45 am, edited 2 times in total.
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: Reloading Hatches without restarting QCAD

Post by CVH » Mon Aug 24, 2020 7:29 am

Hi John,

I expressed the same frustations .... a while ago.
On good days QCAD is restarted about 200-500 times a day.
On bad days ....
Both in normal mode or in debugger mode.

A custom file handler with T2H was already nececary because of the restrictions for pattern names.
I altered that lateron so it generates up to 99 alternative names on overwrite.
That way I can created a bunch of test versions side by side ... before rebooting.
QCAD can't store these files directly to the protected OS portion on a standard win installation.
I have to move them in as Admin.

QCAD with the rescan option already reloads addon's, that is fine when T2H is altered even in debugger mode.
The re-open former files is already a big time saver on reboot.
For reloading pat patterns I didn't find any alternative as a reboot.

In fact it's merely an internal list that has to be updated.
Like the resync for libraries.

And that is done in RPatternList.cpp
Called only from main.cpp
In other words: On boot.

Regards,
CVH

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Reloading Hatches without restarting QCAD

Post by John Hyslop » Mon Aug 24, 2020 7:44 am

Hi CVH

Well at least it opens up last saved drawings now...

Thanks for the feedback..

Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: Reloading Hatches without restarting QCAD

Post by CVH » Mon Aug 24, 2020 8:30 am

Next question would be:
Is it even possible ... ?

It is of no issue for lib's because they actually put a non related copy in the drawing.

What happens if you alter a pat definition while that is used as a pattern in the current drawing ... ?
This is before save ... In drawings opened the stored pattern is used !!!

Line types is similar but for that there is a reload in Misc .. Modify ... The script is even very simple.

And for what it is worth, I can't even find the text 'hatchregen' in the (open) resources.
That should be a DefaultCommand text of the Hatch Regeneration in Misc .. Modify

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9061
Joined: Fri Mar 30, 2007 6:07 am

Re: Reloading Hatches without restarting QCAD

Post by andrew » Tue Aug 25, 2020 8:29 am

Hatch patterns are stored in the drawing file, as part of the drawing as soon as they are used in the drawing. When a drawing is loaded, the hatch pattern as stored in the drawing is used. This is important for drawing exchange as user A might have different hatch patterns than user B.

To reload pattern definitions from the .pat files that come with QCAD, you'd have to reinitialize the patterns from the .pat files and also update the patterns in the document from the list of global patterns:

Code: Select all

// reload patterns from .pat files:
RPatternListMetric.init();
// force update of patterns in document:
doc=getDocument();
doc.setMeasurement(RS.Metric);
As this is all under the hood, this will not immediately update the display. Selecting the hatch or selecting all entities would take care of that.

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Reloading Hatches without restarting QCAD

Post by John Hyslop » Tue Aug 25, 2020 9:51 am

Fantastic
Thanks Andrew :)

Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: Reloading Hatches without restarting QCAD

Post by CVH » Tue Aug 25, 2020 10:25 am

Thanks Andrew :P
Took seconds to implement.

Regards,
CVH

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: Reloading Hatches without restarting QCAD

Post by CVH » Tue Aug 25, 2020 12:10 pm

That was for METRIC documents.
We are swapping measurement systems and/or have different documents types open.

For IMPERIAL documents use:

Code: Select all

RPatternListImperial.init();
&
doc.setMeasurement(RS.Imperial);

Code: Select all

doc = getDocument();
// Reload patterns from .pat files:
doc.isMetric() ? RPatternListMetric.init() : RPatternListImperial.init();
// Force update of patterns in document:
doc.setMeasurement(doc.getMeasurement());
Works for both I presume.
CVH

Post Reply

Return to “QCAD 'How Do I' Questions”