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?
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âŚ
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âŚ
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.
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.
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âŚ
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.
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()
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?