Hello,
I wonder if there is a way to select by print color ?
If no, this could be handy to change white colors to black for print.
I have this script from my library, see if it works for youâŚ
SelObjsByPrintColor.py (2.3 KB)
âMitch
Thank you so much Helvetosaur, It works. I wonât ask you the impossible, this function could be implemented as independent or native startup script.
Thanks again.
Well, I think the best thing to do would be the following:
-
Save the script somewhere where you can easily retrieve it. The âusualâ place is:
C:\Users\<username>\AppData\Roaming\McNeel\Rhinoceros\5.0\Scripts
-
Create an alias such as âSelByPrintColorâ with the following as the command part:
! _-RunPythonScript "fullpathtoscript\scriptfilename"
Example:
! _-RunPythonScript "C:\Users\yourname\AppData\Roaming\McNeel\Rhinoceros\5.0\Scripts\SelObjsByPrintColor"
-
Any time you type the alias and Enter, the script will run, so itâs like an installed command.
-
If you want a toolbar button for it, simply create a new one and paste the same thing as the alias command in the macro section.
HTH, --Mitch
Thank you so much!
Hi Mitch,
I just tried your script and I am getting this error, which is strange because I believe it has worked on my system before.
any tip what might be goining on here?
thanks!!
Daniel
If you are getting an error message like that, itâs likely that the script encountered a case that I didnât predict - let me lookâŚ
Hmm, the function that gets an object print color source - which is set either by layer or by object - is failing. OK, I see what is likely the case - looks I had not considered blocks, which can have a print color source by parent. That unfortunately complicates things, itâs not an easy fix, as in that case different objects inside a block might have different print colors. And you canât individually select objects inside a block. The easy fix I can do now is exclude blocks⌠probably doesnât help you though.
many thanks Mitch for the swift response and for looking into it!
after all I think excluding blocks is totally fine⌠I wasnât really expecting this to work on blocks at all
whenever you get to it
cheers,
Daniel
I see that I have another script that selects objects by print width that I had modified/updated to accommodate blocks. The procedure is virtually identical. So I can use that as a model. There is one choice to make however:
either
- if any object in the block instance has the corresponding color - select the block instance.
or - only if all objects inside the block have the corresponding print color - select the block instance.
What do you think?
cool.
I think the latter makes more sense. because if the script selects the block, to change individual objectâs print colour, would require a block edit. but changing print colour on the entire block can be done directly from âoutsideâ by using your function.
That would be possible, but in the case of block instance color âby parentâ you would also have to reset that to âby layerâ or âby objectâ first. In any case blocks do complicate things like this enormously, I see that the script for print width which accepts blocks is 50% longer than the one for print color that doesnâtâŚ
ah yes⌠I get you now. personally I donât use by parent at all. just by layer.
but I think the script would do a great job if it would just work on objects and exclude blocks.
we can always do a blockEdit, and use it while being in the edit, or?
Oooh, Iâm not certain I would want to run a script while in BlockEdit⌠Maybe it works, but considering how delicate BlockEdit already is, I think thatâs playing with
ok ok⌠thanks for the warning!
OK, took longer than i thought because I had some stupid bugs that were hard to find⌠So, try out the one below. By default, only if a block object has elements with all the same print color that matches the target print color, will it select. However, if you add an additional False argument to the last line - SelObjsByPrintColor(False)
- it will also select block instances that have at least one of their elements having the target print color, but not necessarily all.
Let me know if you find bugs in this oneâŚ
SelObjsPlusBlocksByPrintColor.py (4.2 KB)
thanks man, very nice of you.
I see, this is even the luxury version with the block option included
just came back to the computer, looks like its working on the file that showed the error before
I will keep you updated if I encounter anything else.
many cheers,
Daniel