SelCylinder: is it a possible command?

Hello,

Is there a command to select Cylinders in Rhino? As in, those objects created with the ‘Cylinder’ command?

Thanks,

Dan

Some discussion happening here:
Scripting SelBox and SelVolumeSphere - Scripting - McNeel Forum

No. It’s just a NURBS surface.
Unlike applications like AutoCAD, Rhino does not use a bunch of different object types. You may have to get creative to select them specifically.

With some ChatGPT help

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino.Geometry as rg

def select_extrusions_with_circle_profiles():
    # Get all the extrusion objects in the document
    extrusion_objects = rs.ObjectsByType(rs.filter.extrusion)
    
    # Create an empty list to store the selected extrusion objects
    selected_extrusions = []
    
    # Cycle through each extrusion object
    for extrusion_obj in extrusion_objects:
        # Check if the profile curves of the extrusion are circles
        if is_circle_profile(extrusion_obj):
            # Add the extrusion to the selected list
            selected_extrusions.append(extrusion_obj)
    
    # Select the extrusion objects with circle profiles
    rs.SelectObjects(selected_extrusions)

def is_circle_profile(extrusion_obj):
    # Get the underlying Brep object of the extrusion
    brep = rs.coercerhinoobject(extrusion_obj).Geometry.ToBrep()
    
    # Get the edges of the Brep
    edges = brep.Edges
    
    # Check if any edge is a circle curve
    for edge in edges:
        if edge.IsCircle():
            return True
    
    return False

# Call the function to select extrusions with circle profiles
select_extrusions_with_circle_profiles()

Hi Dan - Cylinders are generic ‘extrusion objects’ by default - they are not tagged by how they are created. It would be possible to do some fancy checking in a script to find things that are probably created by Cylinder but it would not be possible to, for example, distinguish cylinders created by Cylinder from extruded circles.
@lignindes - here’s a thing that may help -

SelCylinder.py (1.3 KB)

To use the script set up a macro like so, that you can put on a button or alias:

! _-RunPythonScript “Full path to py file inside double quotes”

-Pascal

1 Like