Double-click to select contour

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

Post Reply
marzof
Junior Member
Posts: 23
Joined: Tue Mar 18, 2014 5:47 pm

Double-click to select contour

Post by marzof » Sun Sep 27, 2015 7:06 pm

Hi,
I wrote a few lines of code to allow a selection contour (very useful command) by double-clicking on entity (except for texts and blocks): it's like the SketchUp selection where double-click extends the selection to the nearest elements and triple-click to all connected entities.
Maybe someone other than me could like it.

The script consists of few lines added in DefaultAction.js e in SelectContour.js. You can find it (well marked in comments) in the attached files.

I'm not a expert on coding and I'm trying some little work on QCAD scripts. I hope it's not inappropriate.
Bye
Attachments
SelectContour.js
(4.63 KiB) Downloaded 813 times
DefaultAction.js
(23.11 KiB) Downloaded 825 times

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

Re: Double-click to select contour

Post by andrew » Mon Sep 28, 2015 1:26 pm

Excellent idea, thanks. I've integrated this into the master branch. The affected files are:

https://github.com/qcad/qcad/blob/maste ... tAction.js
https://github.com/qcad/qcad/blob/maste ... Contour.js
https://github.com/qcad/qcad/blob/maste ... cesPage.ui

I've taken the liberty to refactor SelectContour a bit to avoid the need for SelectContour.prototype.entityDoubleClickEvent.

I've also added support for shift-double-click to add a contour to the current selection (or remove from current selection).

Please let me know under what name or pseudonym I can credit you in the about dialog (currently as 'marzof'):
https://github.com/qcad/qcad/blob/maste ... Credits.js

To keep up backwards-compatibility, this new behavior is optional and can be controlled through:
Edit > Application Preferences > Graphics View > Behavior > Double-click to select contour

marzof
Junior Member
Posts: 23
Joined: Tue Mar 18, 2014 5:47 pm

Re: Double-click to select contour

Post by marzof » Tue Sep 29, 2015 11:54 am

Great!

Please take all the liberty you need to get a better code.
Also the idea to support the shift-double-click is very useful.

For the credits my name is Marco Ferrara

Bye

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

Re: Double-click to select contour

Post by andrew » Tue Sep 29, 2015 5:04 pm

OK, thanks. I've updated the credits in the about dialog accordingly.

olly
Full Member
Posts: 71
Joined: Wed Jan 25, 2012 1:28 pm

Re: Double-click to select contour

Post by olly » Sat Oct 10, 2015 4:27 pm

very nice ;-)

the double-click works too, editing Layernames

Thanks ;-)

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”