Script needed

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

dave5
Newbie Member
Posts: 4
Joined: Thu Apr 19, 2012 6:15 pm

Script needed

Postby dave5 » Tue May 08, 2012 2:33 am

I need a script that will open a DXF file, convert all the solid lines to the color blue and save the resulting files as a DXF. This script will be executed via the commandline.

Based on my reading of the docs this looks fairly straightforward, but I don't have the time put the script together myself. I would be willing to pay a bounty for this script.

Apologies if this seems a little douche-baggy, but I am under a tight deadline.

Cheers

Dave

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

Re: Script needed

Postby andrew » Tue May 08, 2012 9:25 am

I should be able to put this together quickly. I'll post the script here when I'm done.

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

Re: Script needed

Postby andrew » Tue May 08, 2012 12:54 pm

Attached, you can find a simple script 'ExSetColor.js' and the test drawing I've used.

What the script does:
- find all line entities with linetype set directly to 'continuous' or with linetype 'ByLayer' and the layer linetype 'continuous'
- change the color of those entities to blue
- entities that are not lines are not touched
- entities that have their linetype set to something else than 'continuous' are not touched

Limitations:
- entities that have the linetype set to 'ByBlock' are not touched, even though they might be continuous. This would need some further work as blocks can be hierarchical.

Installation:
- save file ExSetColor.js, e.g. to the QCAD application installation folder.

Usage:
cd [path to qcad]
./qcad -autostart ExSetColor.js [input file] [output file]

Example:
./qcad -autostart ExSetColor.js test.dxf output.dxf


Feel free to donate something if you find this useful.
PayPal: account 'shop@ribbonsoft.com'
Moneybookers: account 'shop@ribbonsoft.com'
Attachments
test.dxf
Example file for testing.
(42.2 KiB) Downloaded 332 times
ExSetColor.js
Script.
(3.02 KiB) Downloaded 359 times

dave5
Newbie Member
Posts: 4
Joined: Thu Apr 19, 2012 6:15 pm

Re: Script needed

Postby dave5 » Tue May 08, 2012 4:06 pm

Thank you Sir. Works a treat.

This confirms my belief that you guys are onto something really wonderful with QCad 3.

I have made a donation into your PayPal account.

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

Re: Script needed

Postby andrew » Tue May 08, 2012 4:28 pm

Many thanks for your donation! Let me know if you require any adjustments or to automate other processes.


Return to “QCAD Developers and Contributors”

Who is online

Users browsing this forum: No registered users and 1 guest