Reloading of Script before execution

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
User avatar
hungerburg
Premier Member
Posts: 160
Joined: Fri May 28, 2010 7:35 pm

Reloading of Script before execution

Post by hungerburg » Mon Sep 26, 2011 3:09 pm

Andrew, how do you do it, that a script gets reloaded from file on each execution?

The first custom script, the one that is called from the menu or button, will be reloaded each time, if the "beginEvent" hook ends with a "delete Foo" statement, Foo being the name of the class itself.

But classes instantiated inside of this class will not be reloaded the next time the first one is instantiated, and if I delete them, they will be missing then.

There must be a special trick that you apply and that I dont understand. Would you explain?

Peter

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

Post by andrew » Mon Sep 26, 2011 3:59 pm

We've introduced the command line option -always-load-scripts for this:

./qcad -always-load-scripts

See also output of:

./qcad -help

Deleting classes is no longer required with this switch.

User avatar
hungerburg
Premier Member
Posts: 160
Joined: Fri May 28, 2010 7:35 pm

QCAD3 rocks

Post by hungerburg » Tue Sep 27, 2011 9:57 am

Ahh, this is good news for people like me, that follow a very iterative approach to development - Thank You.

I tried now calling a script from commandline with the name specified for such occasions in the "beginEvent", but get this Warning: RGuiAction::getByScriptFile: no action found: "MyScript".

Using the path relative to the qcad3 root "scripts/..." works though. Using the -exec argument after a filename will even first load the file and then perform the action on it in one go. Great!

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

Re: QCAD3 rocks

Post by andrew » Wed Sep 28, 2011 12:21 pm

hungerburg wrote:I tried now calling a script from commandline with the name specified for such occasions in the "beginEvent", but get this Warning: RGuiAction::getByScriptFile: no action found: "MyScript".
The -exec switch expects an absolute or relative path to a script that contains a class with the same name as the file name and has a beginEvent function.

If I understand you correctly, you tried to pass -exec a class name. That is an interesting thought. Feature request:

http://www.ribbonsoft.com/bugtracker/in ... ask_id=277

MikeMillerPE
Junior Member
Posts: 10
Joined: Sat Jun 02, 2018 7:59 pm
Location: Walnut Creek, CA

Re: Reloading of Script before execution

Post by MikeMillerPE » Sat Jun 02, 2018 8:11 pm

Hi,

I'm trying to do this on Windows 10 command line with QCAD 3.20.1.0, using the modified form from within f:\Program Files\QCAD\.

qcad -always-load-scripts.

I get the splash screen but the program aborts. Is there another way to enter the command line switch?

Thanks in advance,
Mike Miller, P.E.

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

Re: Reloading of Script before execution

Post by andrew » Wed Jun 06, 2018 9:34 am

I can confirm this is broken and will likely be fixed in the next version.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”