selection feature(s)

Please use this forum to post feedback and suggestions related to QCAD version 3

Moderator: andrew

selection feature(s)

Postby LeoP » Mon Mar 01, 2010 3:00 pm

What would be really useful is a method to select entities by type, rather than by location or layer.

It could have a user interface like the snap command with buttons for the entity type to select, or like the line command with a drop-down box.

This would enable one to quickly select e.g. all texts in a drawing for subsequent attribute modification. Now one has to select each text individually if the texts are scattered over the drawing and layers...
LeoP
Active Member
 
Posts: 38
Joined: Sat Feb 13, 2010 12:01 pm

Postby LeoP » Mon Mar 01, 2010 3:02 pm

:oops: Wrong forum! Should be a QCAD suggestion...

[Edit: topic moved 16/06/2012]
LeoP
Active Member
 
Posts: 38
Joined: Sat Feb 13, 2010 12:01 pm

Re: selection feature(s)

Postby adeetz » Sun Jun 10, 2012 3:38 pm

t could have a user interface ? :mrgreen:
adeetz
Registered Member
 
Posts: 1
Joined: Sun Jun 10, 2012 3:15 pm

Re: selection feature(s)

Postby smf » Sat Aug 04, 2012 9:53 am

Thread start is long ago, but perhaps someone finds it useful: I implemented a widget to do this. See http://www.ribbonsoft.com/bugtracker/index.php?do=details&task_id=663 to download a small zip file. Any comment is welcome!
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sat Aug 04, 2012 1:28 pm

Thanks for the try :D

As far as I know, you only have to copy the files into the correct directory - no special installation is required. I have:
/qcad/ - the qcad directory
/qcad/scripts/ - the qcad scripts directory
/qcad/scripts/MyTools/ - a new directory created below "scripts"
/qcad/scripts/MyTools/SelectWidget/ - a new directory created below "MyTools" named "SelectWidget" (this directory name must not be changed)

The three files reside inside ..../SelectWidget/ and should result in a new widget near the original PropertyEditor. If it does not appear, in the "view" menu there should be an entry "Select Widget" (unfortunately unordered and without suitable icon).

I hope this helps.
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sat Aug 04, 2012 5:11 pm

Thank you for trying it and for your feedback! :D

If you select only one entity, all fields in the Selection Widget should be disabled. If you select multiple entities, all fields for diverse properties should be enabled. If those are changed, the selection should be updated. For example 1) selecting a red and a yellow line, changing the color field in Select Widget should result in a changed selection, or 2) selecting a line and a text, changing the type field in Select Widget, should deselect either the line or the text.

Indeed most of the code is identical to the Property Editor. If there would be an option "reduce selection instead of modifying selected entities" a merge of Property Editor and Select Widget (most likely together with some fixes in my code) should be easy.

I would be pleased to receive further feedback! :D
Last edited by smf on Sat Aug 04, 2012 7:23 pm, edited 1 time in total.
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sat Aug 04, 2012 7:30 pm

Unfortunately, at the moment my script is "a bit" slow :( for large selections. Checking the "closed"-property of polylines with appriate selection update took ~100 seconds for ~2000 selected entities. Probably my usage of the "eval"-statement slows things down, perhaps a callback-method instead of the eval-string would be faster. I'll try this out in a quiet moment.

I don't even know if this functionallity is best as widget (consumes valuable space) or as dialog (only useful if not used too often). What do you think?
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sun Aug 05, 2012 8:07 am

The "eval" function is not the slow down master. :) I changed the eval to a callback, but the consumed time is nearly equal. For beautyness reasons, I will keep the callback variant. :D

Inside the following code snippet:
Code: Select all
    var entityIds = doc.querySelectedEntities();
    for (var es = 0; es < entityIds.length; ++es) {
        var id = entityIds[es];
        var e = doc.queryEntity(id);
        /* ... */
     }

I suspect the doc.queryEntity(id) taking reasonable time (using only the first entity every time the loop is executed in the twinkling of an eye).

So: is there a better way to get all selected entities than getting a list of ids and getting one after one (I don't need the id elsewhere)?
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sun Aug 05, 2012 8:18 am

smf wrote:Inside the following code snippet:
Code: Select all
    var entityIds = doc.querySelectedEntities();
    for (var es = 0; es < entityIds.length; ++es) {
        var id = entityIds[es];
        var e = doc.queryEntity(id);
        /* ... */
     }
I suspect the doc.queryEntity(id) taking reasonable time (using only the first entity every time the loop is executed in the twinkling of an eye).


I was wrong. :oops: It was calling di.deselectEntity too often instead of calling di.delesectEntites once. :D Now it takes less than a second instead of ~100 seconds to process about 2000 entities. :D I will upload a new package to the bugtracker.
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby smf » Sun Aug 05, 2012 2:26 pm

Thank you very much for testing! :D I'm happy to see someone else using this! :D

I have uploaded a version 5 that enables "nearby comparison" for math values (i.e. to match "24.99998" if "25" entered), icon still missing. :wink:
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm

Re: selection feature(s)

Postby J-J » Tue Aug 07, 2012 6:24 am

Thanks for the effort, your addition is quite useful!
User avatar
J-J
Moderator
 
Posts: 310
Joined: Tue Mar 24, 2009 9:48 pm

Re: selection feature(s)

Postby smf » Thu Aug 16, 2012 5:35 pm

After some days I fixed the nearby-comparison for negative values and added an icon. :D
smf
Premier Member
 
Posts: 162
Joined: Tue Feb 28, 2012 1:05 pm


Return to QCAD 3 Suggestions and Feedback

Who is online

Users browsing this forum: Bing [Bot] and 3 guests