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

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
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: 9037
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 Programming, Script Programming and Contributing”