Re-OPEN SOLVED: Addressing regular Qcad scripts

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
CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re-OPEN SOLVED: Addressing regular Qcad scripts

Post by CVH » Wed Aug 28, 2019 3:35 pm

Andrew,

To make use of the addSpline simple API I included simple.js in my script.
Just as prescribed but I had to use 'include("scripts/simple.js");' ... and more
I had to put the physical scripts under the Qcad scripts folder.
Along with the script files: simple_create.js, simple_info.js, simple_input.js, simple_modify.js,
simple_transaction.js, simple_view.js.
And those are simply included by simple.js as a plain 'include("xyz,js").
Something similar is true for sprintf.js.
All in contradiction with eg. library.js that used to be not included in my script with no file present.
Or the inclusion of EAction in Misc.js as 'include("scripts/EAction.js");' with no file present.

I presumed that all scripts where present as compiled versions in a Win installer.

It seems that this is made straightforward for some but not for all.
OR
I am completely missing something here.

Regards
Last edited by CVH on Sun Sep 08, 2019 5:35 am, edited 2 times in total.

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

Re: Addressing regular Qcad scripts

Post by andrew » Wed Aug 28, 2019 8:32 pm

Code: Select all

include("scripts/simple.js");
should work (and does work here). No need to copy any files into your QCAD installation. All scripts are compiled into the qcadscripts plugin.

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

Re: Addressing regular Qcad scripts

Post by CVH » Thu Aug 29, 2019 11:28 am

SOLVED

Well, I have some well documented 'Include structures trees' in the top of several experimental scripts.
And their only purpose was to have an overview where what is included, literally how and if it was/is not present.
If they were not present and an error was trown at load or at runtime the appropriate files where sourced from Github.
Every update since ...
viewtopic.php?f=8&t=5624&p=20916#p20925

At the cost of countless hours of restarting Qcad over and over again.
Without, with and again without the debugger.

In the last year I updated regularly.
A few times I did a deïnstallation and a 'clean' install for what it's worth.
If that did not solved the issues in the past, and as a system restore from over a year ago is out of the question...
I have decided to wipe Qcad and any traces of the system before a reinstall.
I can't advice anyone to try this on a win system without having some experience in this process.
Any fault in this may irreversibel corrupt the complete system.
Also recommended is having a second system to source the internet when you get stuck.

I've added a verbose summary for the most daring.

Andrew, maybe you could update the header of simple.js and set the correct include text.

Thanks,
Regards
Attachments
Wipe Qcad from win.txt
(1.98 KiB) Downloaded 623 times

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

Re: SOLVED: Addressing regular Qcad scripts

Post by andrew » Thu Aug 29, 2019 11:34 am

Hmm.. uninstalling ("wiping") QCAD is as simple as deleting its installation folder (that is one single folder with all its contents) and that's it.

Resetting the configuration is slightly more involved to delete the file QCAD3.ini:
https://qcad.org/en/tutorial-resetting- ... figuration

I'd certainly not recommend anyone to go through the ordeal described in the above document ;)

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

Re: SOLVED: Addressing regular Qcad scripts

Post by CVH » Thu Aug 29, 2019 11:40 am

It's the only thing that did the trick so far.
Lets hope more of my issues were solved.

Regards

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: SOLVED: Addressing regular Qcad scripts

Post by Husky » Thu Aug 29, 2019 7:24 pm

andrew wrote:
Thu Aug 29, 2019 11:34 am
I'd certainly not recommend anyone to go through the ordeal described in the above document ;)
I second that!
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

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

Re: Re-OPEN SOLVED: Addressing regular Qcad scripts

Post by CVH » Sun Sep 08, 2019 6:31 am

Re-encountered it with this topic:
https://qcad.org/rsforum/viewtopic.php?t=6552

This time I know exactly what I did: it only took me 35 min
And my memory is not that bad yet.

Downloaded most recent zip with Qcad master from Github >> Data drive / Copy downloads
Expanded under Copy downloads/master files.....
Created subfolder C:\Program Files\QCAD\scripts\Modify
UAC >> yes, I'm Admin
Created subfolder C:\Program Files\QCAD\scripts\Modify\Scale
UAC >> yes, I'm Admin
Copied Scale.js from master to C:\Program Files\QCAD\scripts\Modify\Scale
UAC >> yes, I'm Admin
Copied and renamed to Scale.js.org
UAC >> yes, yes, I'm Admin
Implemented change to Scale.js with NPP
Save >> Admin mode? yes, ... (NPP reopens in Admin mode)
Save

Started Qcad in debugger mode
Errors with associated files so closed Qcad
Tried to no avail some different include's eg. without path
Copied and renamed to Scale.js.new >> UAC...
Copied complete master Scale folder to C:\Program Files\QCAD\scripts\Modify >> UAC...
Deleted original Scale.js and renamed Scale.js.new back >> UAC...
Implemented Optionbutton in ScaleDialog.ui with Qt Designer (5.11.1)
Qt Designer can't write back to protected OS portion
Saved temporary on datadrive, this messes up the paths of the pics
Copied over to C:\Program Files\QCAD\scripts\Modify\Scale >> UAC...
Corrected pic paths with NPP
Saved (is in admin mode)
Implemented Optionbutton in Scale.js with NPP
Saved (is in admin mode)

Started Qcad in debugger mode
Errors with associated files in Modify folder so closed Qcad
Tried to no avail some different include's eg. without path
Copied all 6 files from master Modify folder to C:\Program Files\QCAD\scripts\Modify >> UAC...

Started Qcad in debugger mode
works as a charm

Again I have to have a copy of all files involved under Qcad

Help!?
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”