Modify Circle Radii

Do I recall seeing a script some time ago (it could even have been on the old NG) that selected all circles of a certain radius - either by typing the rad on the command line, or picking one in the model - and then replaced them all with circles of a different radius?

Or was it just a nice dream I was having? :smile:

No, I have one… This one is on diameter, not radius and does require you to pick a circle of the diameter you want to change (can’t key in a radius). I could modify it somewhat if you need. It’s a vb that is actually set up for drag and drop…

–Mitch

ReplaceCircleDia.rvb (1.3 KB)

1 Like

Quick response Mitch! That could well be the one I was thinking of. Many thanks. My need (or rather, my friends need, as it is he that I’m trying to help out) has a DXF for cnc cutting that has a load of arrayed holes in it that he wants to change diameter. In scripting terms I think it’s a fairly simple matter, as everything is flat on the XY plane. Coming up with something that would stay ‘on-plane’ to the original circles, no matter what their orientation, I can imagine would be a tougher call.

This should not change the circle plane… All it does is scale the circles about their centers uniformly in 3D, so in theory at least, they should remain in their original plane no matter what…

–Mitch

Here is a python script that will allow you to select either an existing circle of the radius to change, or key in a radius value to search for in the document - if any circles are found with that radius, they will be changed.

–Mitch

ReplaceCircleDia.py (2.0 KB)

Here are a couple of ancient RhinoScripts - Drag and Drop the rvb files for

EditArc

EditCircle

I see the functionality somewhat overlaps, but who knows, might be useful.
EditArc.zip (2.9 KB)
-Pascal

Now that’s just showing off… :smile:

Many thanks Mitch (and Pascal - perhaps those are the ones I was thinking of)

Nah, I just do it for the learning experience and the distraction… In this case just playing with the GetObject() UI - the actual “action” part of the script is about 2 lines and the same as the previously posted vb script.

–Mitch

Hi @pascal and @Helvetosaur

I was googling and found this topic.
Is there a script to separate circles by diameter or radius?

Maybe place them in specific layers…

Thanks

Don’t think so, but it isn’t hard to create one… The problem might be that if you have a lot of different diameter circles it can create a lot of layers…

–Mitch

I´m using Rhino for mold design and nomally we have from 1 to 5 diferent diameters.

Man I really have to learn Python!! @Helvetosaur, how long did took you to learn Python scripting?

Selection circles by diameter is present in SurfCam, and I miss this feature in Rhino. I found grasshopper file def_01.gh when searched for this feature. Unfortunately the script is not capable to select circles with specified range of diameter- e.g. from 8 to 9mm and the selection of objects after its highlighting is not possible.

Well, I started with (vb) Rhinoscript in 2009 (Python for Rhino did not yet exist) and was reasonably proficient after perhaps 6 months. I did take a 3 day class in Rhinoscript offered at McNeel Barcelona at the time taught by Luis Fraguada, and also worked through the Rhinoscript 101 primer by David Rutten.

Switching to Python gradually starting in 2011, I picked up a book on basic Python programming (there are tons) and started with rhinoscriptsyntax, which is basically the vb Rhinoscript methods adapted to Python. From there I just kept going, delving more into into RhinoCommon as time went on.

There is that initial “hump” to get over where everything looks completely foreign and abstract and you think you will never understand. However, once you get the hang of a few basic programming/scripting principles and a bit accustomed to the level of abstraction, it gets a lot easier. Everyone’s experience will be different, some people pick this stuff up really fast, others just never really get into it.

–Mitch

This one does (works on radius, not diameter though):

SelByRadius.py (2.8 KB)

–Mitch

2 Likes

Thanks, I’ll try this script. I have from my colleague an Al plate with many threaded holes like M6, M8 and M10

Here’s a quickie hack…

import rhinoscriptsyntax as rs

def CirclesToLayer():
    circles=[obj for obj in rs.ObjectsByType(4,1) if rs.IsCircle(obj)]
    if circles:
        prec=rs.UnitDistanceDisplayPrecision()
        rs.EnableRedraw(False)
        for circle in circles:
            dia=rs.CircleRadius(circle)*2
            layer_name="Circle_Diameter_{}".format(round(dia,prec))
            if not rs.IsLayer(layer_name): rs.AddLayer(layer_name)
            rs.ObjectLayer(circle,layer_name)
CirclesToLayer()

–Mitch

I’m getting “oops that page is private” when I try to click the download.

Is this still the only way to change the radius of an Arc, even in Rhino 6?

Hello - use ModifyRadius

-Pascal

1 Like

Thank you! Is there any way to make one or both ends of the arc remain in place while doing that? Also, is there any way to get a preview, or do you have to type a number?

Hello - no, that tool is pretty simplistic…

-Pascal