Select curves by print width

Hello,

is there a possiblity to select curves by print width? I would also use Rhinoscript if there was a way to get there…

You can try this script from my library… I’ve got a couple others with slightly different possibilities as well…

–Mitch

SelObjectsByPrintWidthDLG.rvb (843 Bytes)

Hi Rgina

Here is a quick setup:
It asks for a seed object to select and selects all objects with the same print width.

SelectSamePrintwidth.rvb (837 Bytes)

-Willem

Hi Mitch (reviving an old thread :slight_smile:) - Is there any reason why this script should initiate REALLY slowly? For some reason, it’s taking something over 10 seconds for the script to run. The script is assigned to a button. Rhino doesn’t freeze when it’s called - in fact I can carry on with another command and the dialogue box then appears some time later.

If you have a LOT of curves, it will run pretty slowly, as it sorts through all the curves in the file…

It’s a pretty old script (2010), I see at least one possibility to tune it up a bit…

–Mitch

Just over 91,000 curves in the file I’m currently working on. That’s why I need the script! :wink:

OK, how many of the 91K curves are visible at one time?

All of them. There are quite a few more that are currently hidden. It’s all 2D drafting work, with some imported stuff mixed in.

OK, will see what I can do after lunch, but there won’t be any miracles… Can’t use Python because GetPrintWidth() (dialog) is not yet implemented…

Are you needing to select a print width from the dialog, or will entering a value/selecting an object that has the width you want also work for you? If so, you can try this one:

SelCrvsByPrintWidth.py (2.0 KB)

Not sure it’s any faster though. Let me know if it is.

–Mitch

It’s very useful having all print widths listed, especially for the imported stuff. Some of the print widths used are random, to say the least. I’ll give the Python script a go anyway, just to see how quickly it runs. As an aside, Willem’s script (above) runs very quickly, but I assume that’s because it’s not having to sift through the entire file looking for different print widths?

Dunno, it does essentially the same thing as mine. By the way, the original .rvb posted above from me doesn’t even work… Has a major bug. Below is a fixed version, and I added a status bar progress meter plus reporting the number of curves selected at the end. I created a test file with 100K lines and 5 different print widths, it takes about 12 seconds to run. Willem’s above takes about the same amount of time.

SelCurvesByPrintWidthDLG.rvb (1.3 KB)

–Mitch

Thanks Mitch. What would now cause me to get this?:

EDIT: Found the error. All sorted now. I like the progress bar Mitch - a nice touch.

How do you have it set up to run? It’s not currently written for drag-and-drop installation… --Mitch

I had it previously saved as SelObjectsByPrintWidthDLG. Ooops. I don’t tend to install by drag-and-drop, so didn’t have to deal with that. It would be nice to have something in the Rhino help file about installing .rvb and .py scripts. Just about every time I do it, I end up on google… :confused:

OK - note that this uses the rhinoscript function GetPrintWidth() which throws up a “standard” dialog that does not include any custom print widths in the file - although you can still type a custom value in the box inside the dialog. I am working on something which will find all the print widths of objects/layers and use that for the dialog…

–Mitch

But - the old script was finding them before? I’ll try it on a file that I haven’t cleaned up

Here, you can try this one on for size… May also be a bit faster than the previous ones.

Edited - detect “No print” and “Hairline” for width dialog

SelCrvsByPrintWidthDLG.py (2.6 KB)

–Mitch

That one’s running a LOT quicker. Thanks Mitch. Amusing that ‘No Print’ lines show up as -1.0 print width :smiley: . For some reason it’s listing a line width of 14.11111 even after Purge, but Rhino can’t find any curves of that width when requested to do so. I assume this only detects visible curves, as running it after HideSwap gives a different list of line widths?

Yeah, didn’t do any real checking for those types of things - also “hairline” is likely to show up as 0.00. I might be able to tune that up.

The 14.111 value might be coming from a print width assigned to a visible layer in the file - the script looks at both visible/selectable object and layer print widths for the dialog. I don’t know where else it might be found…

And yes, if you hide or lock objects/layers, those do not get counted, the idea is to limit the choices in the dialog to what you can actually select.

–Mitch

OK, new version up there that shows "No Print and “Hairline” in the dialog… --Mitch