[solved] reopen the dxf file after it has been modified externally

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

Moderator: andrew

Post Reply
Nick1974
Newbie Member
Posts: 5
Joined: Fri Sep 29, 2017 11:35 am

[solved] reopen the dxf file after it has been modified externally

Post by Nick1974 » Wed Oct 11, 2017 2:05 pm

Hello.
How I can say to qcad so it reopens the dxf file after it has been modified externally?

I draw from ECMAScript:

1. Open qcad
2. Edit myscript.js and run from editor

Code: Select all

qcad -allow-multiple-instances -autostart myscript.js && qcad /tmp/myscript.dxf
3 View result in qcad
4. Switch to qcad
5. Close documet /tmp/myscript.dxf (Ctrl-W)
6. Switch to the editor
7. Goto 2

If qcad reopens the dxf file after it has been modified externally, I will be able to stay in the editor:

1. Open qcad
2. Edit myscript.js and run from editor

Code: Select all

qcad -allow-multiple-instances -autostart myscript.js && qcad /tmp/myscript.dxf
3 View result in qcad
4. Goto 2

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

Re: reopen the dxf file after it has been modified externally

Post by andrew » Wed Oct 11, 2017 2:11 pm

You could trigger a File > Revert after running your script:

1. Launch QCAD (and keep it running):

Code: Select all

qcad /tmp/myscript.dxf
2. Regenerate file and trigger File > Revert when done:

Code: Select all

qcad -allow-multiple-instances -autostart myscript.js && qcad -exec scripts/Pro/File/RevertFile/RevertFile.js
A warning dialog will be shown in QCAD if the file has been modified in QCAD.

Note that launching QCAD if it is already running will pass the arguments to the running instance. This way you can open additional files from the command line or trigger commands as shown above.

Nick1974
Newbie Member
Posts: 5
Joined: Fri Sep 29, 2017 11:35 am

Re: reopen the dxf file after it has been modified externally

Post by Nick1974 » Mon Oct 16, 2017 12:01 pm

Many thanks!

Post Reply

Return to “QCAD Developers and Contributors”