Share your favourite scripts, macros and plug-ins

Hi all!

Made some new color editing scripts today and figured I’d share them! These are designed to quickly set colors without keyboard shortcuts.

The first is a script that allows you to input HSV values in the command line rather than opening the color picker:

SetColorHSV.py (1.8 KB)

The next breaks this script down into three commands that independently edit hue, value, and saturation (good for if you, say, want 6 objects of different colors to all be brighter)

SetValue.py (2.4 KB)

SetSaturation.py (2.4 KB)

SetHue.py (2.3 KB)

The next twelve are scripts that just set an object to a color, each 30 hue increments apart. I have this set so aliases that go (SC# (SetColor#) - I actually use letters here - so SC Q W E R A S D F Z X C V) - like a little paint palette on my keyboard

HSV_090.py (1.2 KB)

HSV_120.py (1.2 KB)

HSV_000.py (1.2 KB)

HSV_030.py (1.2 KB)

HSV_060.py (1.2 KB)

HSV_210.py (1.2 KB)

HSV_180.py (1.2 KB)

HSV_150.py (1.2 KB)

HSV_120.py (1.2 KB)

HSV_090.py (1.2 KB)

HSV_300.py (1.2 KB)

HSV_270.py (1.2 KB)

HSV_240.py (1.2 KB)

HSV_330.py (1.2 KB)

And then the last set I have set up to nudge the hue or saturation plus or minus ten without going through any command line options, so instead of setting the HSV over and over you can use shortcuts to just nudge it up and down. This works well paired with a repeat shortcut.

HSV_SaturationPlusTen.py (2.1 KB)

HSV_HueMinusTen.py (2.1 KB)

HSV_HuePlusTen.py (2.1 KB)

HSV_ValuePlusTen.py (2.1 KB)

HSV_SaturationMinusTen.py (2.1 KB)

HSV_ValueMinusTen.py (2.1 KB)

Sorry things got pasted a little out of order, but hope some folks find this useful. For my workflow (which currently involves using rhino to make a lot of graphics) these are making things much more painless!

Looks like these could be organized into a custom toolbar with multiple buttons. In the past I usedn similar toolbar with 20 different icons with scripts to quickly assing a set of custom object colours.

I like this idea! I’m an “all command line/macro” workflow person, but I think it’s definitely true that these could be grouped into buttons!

I tested these out with a many-colored image last night that would’ve not really been doable in Rhino before. I found the color workflow to be much more fluid but found myself wanting a few more things… I’ll add any additional useful scripts to the post above :slight_smile:

Cover.pdf (1.2 MB)

I have a small pile of scripts that I find extremely useful. I keep telling myself I want to refine them before I start sharing them, but the current toolbar system isn’t conducive to what I would like to accomplish so maybe I’ll get them to that point at a later date.

BatchViewCaptureFromNamedViews.py (11.7 KB)
This is a pretty useful one for anyone who does progress or change captures.

  • Run Script
  • Select Named Views from the list that you wish to batch capture.
  • Select the location to save to.

It will cycle through and save an image of each view appending the date/ time to the end of the Named View name.
If not present, an archive folder will be created in the same location as the images.
Upon future uses it will automatically move existing images into the archive folder when a newer version is saved.

Basic options settings can be toggled by changing:
SHOW_COMMAND_OPTIONS_UI = False
to
SHOW_COMMAND_OPTIONS_UI = True

They are set to false as I always use the same settings and was trying to keep it simple and fast to use.

I’m not great at writing scripts so if you make improvements, please share them back with me.

Here is the Macro button image I use with it if anyone wants something quick and easy.

Dynamically Label Curves’ Names & Lengths

Trying to get back into scripting again, and needed these for work.
Two versions using varying ways of calling some of the same actions. One results with plain text, and the other uses a Leader approach. Notes abound, as I wanted to remind myself later of how it works. Hope they’re useful to someone!

AddDynamicNameAndLengthUnderCrv_Leader.py (2.1 KB) (May have some unnecessary lines)

AddDynamicObjectInfo_Text.py (2.2 KB) (Updated Script - includes non-dynamic CurvePiping 260210)

Pascal Golay made a very useful macro for adding a point at the current Gumball origin.

! _SetRedrawOff _CPlane _Gumball _Point 0 _CPlane _Undo _SetRedrawOn

I often use alternative “Isolate” commands. The first one is the default “Isolate” in Rhino. The alternative one is a macro that do a similar job.
However, it’s important to “Unisolate” these in the same order like how they were activated, because any accidental use of the improper “Unisolate” may result in a lost history of what was visible initially. For example, when I use Rhino’s default “Isolate” as the first state of isolation of several objects, then I select one of these object and run an additional “Isolate” macro to temporarily hide the rest ones, then I must use the “Unisolate” of the macro first, then run Rhino’s “Unisolate” command last. Only then the state of hiding the rest objects is kept intact and can be restored.

Default Rhino isolate commands (LMB/RMB):

Isolate objects:
! _Isolate

Unisolate objects:
! _Unisolate


Alternative macro with isolate commands (LMB/RMB):

Isolate Selection 1:
_-Invert _-Hide _Pause "TempIsolate 1" _Enter

Unisolate Selection 1:
! _-Show "TempIsolate 1"


Another alternative macro with isolate commands (LMB/RMB):

Isolate Selection 2:
_-Invert _-Hide _Pause "TempIsolate 2" _Enter

Unisolate Selection 2:
! _-Show "TempIsolate 2"


P.S. You can make as many of these as you wish, just change the number in the macro.

BatchViewCaptureFromNamedViews v2.py (10.6 KB)

here’s an improved version, it has way more options now

Good call on RhinoCommon.

BatchViewCaptureFromNamedViews v2 - Snip
Due to designing as we build, the archive folder is certainly not useless in our case. It presents a design evolution that many of our non-Rhino users can refer to for context.

I had intentionally hardcoded the defaults to speed up my run time as I would rarely change the settings when using batch capture and can’t stand having to click through a half dozen options every time I use the tool.

I added a basic UI for changing the settings, so you don’t have to click through a bunch of options pointlessly.

There are likely issues across different Rhino versions, and I didn’t spend any time checking how this behaves with custom Rhino UI color settings so there could be friction there . Give it a spin and let me know what works and what doesn’t.

I was unable (Didn’t try very hard) to get the preview to lock, so one can pan and zoom within it :roll_eyes:. I noticed that the preview doesn’t reflect the axes toggles in rendered mode also. The preview in general likely has a cleaner method of execution, I simply used what I could make work. Feel free to tune it up and share it back.

BatchViewCaptureFromNamedViews.py (73.7 KB)

Hi Ryan,
your script look very usefull for many people I would suggest to put it into a new thread so we can search for it.
Hiding this gem in this long list is a shame. :smiley:

A few new ones I just created for my architectural drawing workflow:

AutoPrint.py (5.1 KB)

Draw a rectangle of any size and run this script. Type the DPI, filename, and choose a folder and it exports a JPEG and PDF. A batch version could be useful… maybe in the future.

AutoDash.py (2.7 KB)

This allows you to set a custom dash quickly on an object. You just type in the first length and second length and if there’s not already a dash in your dash library it creates one

! -_Properties _Pause _Object _PrintLineWidth

This is a macro that lets you just type the PrintWidth you want into the command line, allowing you to quickly edit it

PrintWidthtoLayer.py (444 Bytes)

And this script lets you quickly set that custom PrintWidth to the whole layer, so you can test you can test out printwidths using the macro and then once you find one you like you can use this to set it to the whole layer

NewLockedLayer.py (1.0 KB)

I also like to use background colors but sometimes I forget to make it a new layer and lock it and it gets in the way. This is very lazy, but you just run it and it takes your object and puts it on a new locked layer. It’s part of a set of scripts I’ve created which allows you to do layer editing without entering the layer panel.

A quick script for calculating center of mass (one or multiple objects), adding weight depending of a material list or custom density and the resultant of the group of objects. Alle the new data is organized in new layers.

N_centroid_dialog.py (13.3 KB)

I have collected a total of 3 “Project objects” scripts. They all have flaws and can’t project as expected over some shapes, including a basic sphere. Sometimes they work, though.

Only the version from year 2022 is able to project the box on this sample sphere (see the Rhino 7 test 3dm file below).
The version from 2018 projects the box to the bottom inside wall instead of the top of the sphere.
The version from 2021 that you posted above fails entirely.

Test 3dm file:
Project object (project the box over the sphere).3dm (1.2 MB)

From 2018:
ProjectObjects.rvb (5.8 KB)

From 2021:
ProjectObjects.py (11.5 KB)

From 2022 (BEST):
ProjectObjects.rhp (24 KB)


There is also a similar script, but it only moves the object by projecting it onto the target geometry while keeping its structure intact.

MoveProject.zip (2.6 KB)

The “Jeverly for Rhino” plug-in is paid, but seems like a true powerhouse for those who do CNC-milling of complex free-form wooden shapes or do jewelry. However, they don’t disclose the price (or monthly rent?) publicly, so it remains a secret…

Here apparently $498 for the dongle, perpetual license.

I (with the help of Claude) did some editing and I think this version works better than the 2021 version (and hopefully as well as the .rhp version.) And it has a way to re-do the projection after changes.

ProjectObjects.py (20.9 KB)

Hi

Hi

I recommend trying these tools. They’re completely free, come with Project Morph, and perform very well.

This script is not working in my Rhino 7. I unlocked it, but it returns the following warning message: