How do I increase the size of a hole?


#1

I’m looking to increase the size of 2 holes in an object I made. Can’t figure out how to do it.

See my object below:

Any idea? Specifically, trying to increase the radius just a bit.


#2

I create all my holes by Boolean subtraction of cylinders from an object. This is the way I create the drill holes for the cover attachment screws of my cavities. The trick in your case is coming up with the base and height values for the AddCylinder definition:

AddCylinder (base, height, radius, cap=True)
Parameters
base — Required. Point or Plane. The 3-D base point of the cylinder or the base plane of the cylinder.
height --Required. If base is a point, then height is a 3-D height point of the cylinder. The height point defines the height and direction of the cylinder. If base is a plane, then height is the numeric height value of the cylinder.
radius --Required. Number. The radius of the cylinder.
cap ---- Optional. Boolean. Cap the ends of the cylinder. If omitted, the ends will be capped (True).

If you can align the cylinder to your existing holes, then you could adjust their radius to increase the hole size after the Boolean subtraction of the cylinders from your object. Your holes look to be separated by 90 degrees with the top one aligned with the z axis so maybe coming up with base and height values will not be too hard.


(David Cockey) #3

@Terry_Chappell What is “AddCylinder”? It is not a standard Rhino V5 or V6 command.


(David Cockey) #4

One method assuming these are through holes:

  • Select an unused layer as the current layer. (Create a new layer if needed.)
  • ExtractSrf with OutputLayer=Yes and Layer=Current the inside of a hole to be enlarged.
  • Turn off the layer with the object.
  • OffsetSrf the extracted surface by the desired increase in radius.
  • Delete the extracted surface.
  • Explode the offset surface. (Okay if it is single surface and will not explode.)
  • Extend the ends of the offset surfaces so that they extend beyond the object’s surface.
  • Join the extended offset surfaces.
  • Turn on layer with object.
  • BooleanSplit the object using the extended, offset surfaces.
  • Delete the part of the split object you don’t want.

A similar method can be used for blind holes by also extracting the bottom of the hole Extend the extracted bottom surface. Trim and join the extended bottom to the offset sides.


#5

APPROACH USING PYTHON SCRIPT:

I do most of my work in Rhino with Python scripts that use commands from the Rhinoscriptsyntax collection. An example of Python code for the hole enlarging could be:

import rhinoscriptsyntax as rs
# Example sphere placed at z,y,z = origin.
x,y,z = 0,0,0
radius_of_sphere = 10
sphere = rs.AddSphere([x,y,z], radius_of_sphere)
# Create cylinders to enlarge holes.
bottom_of_hole = - radius_of_sphere
top_of_hole = radius_of_sphere
radius_of_hole = 2 # Adjust this to enlarge your holes.
cyls = [0, 1]
cyls[0] = rs.AddCylinder([0, 0, bottom_of_hole], [0, 0, top_of_hole], radius_of_hole)
cyls[1] = rs.AddCylinder([0, bottom_of_hole, 0], [0, top_of_hole, 0], radius_of_hole)
# Creates holes and delete all inputs: sphere and cyls.
new_sphere = rs.BooleanDifference(sphere, cyls)

To create this and execute it follow these steps.
0. First clear your viewport of all objects as this script will be creating new objects.

  1. Type in the Command window: EditPythonScript
    This will put you in the Python script editor.
  2. Copy the code above into the editor window.
  3. Press Ctrl+s to save the file to a name you choose.
  4. Click inside the Python editor window then press Ctrl+F5 to run the script.
  5. If you watch closely you will see the Sphere created and the 2 holes punched in it.

For your case you need to:

  1. Delete the AddSphere line
  2. Adjust all x,y,z values to line up with your holes
  3. Adjust the bottom_of_hole, top_of_hole, and hole_radius dimensions to fit your case.

I find it 10X faster to use the Python script than the Command line with regular tools (see example below) since all the numbers are written down and can be readily changed and the operation repeated in mere seconds (make changes, Ctrl-s, Ctrl-F5). And this script can be re-used the next time this comes up. Plus it breaks the ice and puts you on your way to writing many other Python scripts to help you. To see all the available Python script commands just look to the left of the editor window. There, for example, you’ll see rhinoscriptsyntax. Click on its > to expand out all its commands. Double click on any command to see a popup window describing the details, inputs, outputs, example. I find learning to use new commands much easier with this easily accessible documentation. I am very new to Rhino, only 6 weeks and I tried other approaches which were very slow but now I am making a lot of progress using Python scripts.

APPROACH USING REGULAR TOOLS FROM THE COMMAND LINE:

You can do the same thing using only the command line. First make the Top viewport be the only one shown. Then to reproduce the Python script you would type:
Command: Sphere
Center of sphere ( 2Point 3Point Tangent AroundCurve 4Point FitPoints ): 0,0,0
Radius <1.000> ( Diameter Orientation Circumference Area ProjectOsnap=Yes ): 10
Command: Cylinder
Base of cylinder ( DirectionConstraint=None Solid=Yes 2Point 3Point Tangent FitPoints ): 0,0,-10
Radius <2.000> ( Diameter Circumference Area ProjectOsnap=Yes ): 2
End of cylinder <20.000> ( DirectionConstraint=None BothSides=No ): 0,0,10
Command: Cylinder
Base of cylinder ( DirectionConstraint=None Solid=Yes 2Point 3Point Tangent FitPoints ): 0,-10,0
Radius <2.000> ( Diameter Circumference Area ProjectOsnap=Yes ): —> Type Enter to use 2 again.
End of cylinder <20.000> ( DirectionConstraint=None BothSides=No ): 0,10,0
Command: BooleanDifference
Select surfaces or polysurfaces to subtract from: —> Select the sphere
Select surfaces or polysurfaces to subtract from. Press Enter to continue: --> Press Enter
Select surfaces or polysurfaces to subtract with ( DeleteInput=Yes ): --> Select one of the cylinders
Select surfaces or polysurfaces to subtract with. Press Enter when done ( DeleteInput=Yes ): --> Select other cylinder
Select surfaces or polysurfaces to subtract with. Press Enter when done ( DeleteInput=Yes ): —> Press Enter
Boolean difference in progress… Press Esc to cancel
Creating meshes… Press Esc to cancel
See the picture above for the result. This picture was captured with my Pythonscript PictureCapture.


#6

You could take it into space claim, drag the hole larger, then take it back into rhino !

Steve


(Willem Derks) #7

Hi Brandon

I’d say there is no need to go down the rabbit hole of scripting. All can easily be done with regular tools:

Create cylinders with the increased diameter aligned with the current holes.

Next perform a boolean difference to ‘cut away’ the part of the holes to widen.

Does that make sense?

-Willem


#8

More details for using regular tools are in my prior post. It shows an example with a test sphere in the second half of the post. You could also create the cylinders off to the side by themselves and then hand place them with their Gumball if this helps.

But my recommendation is still to use a Python script since you can iterate to a perfect solution so fast.


(David Cockey) #9

[quote=“Terry_Chappell, post:8, topic:41129”]
More details for using regular tools are in my prior post.
[/quote]AddCylinder is not a “regular tool” if you mean a Rhino command which is directly accessible without using Python.[quote=“Terry_Chappell, post:8, topic:41129”]
You could also create the cylinders off to the side by themselves and then hand place them with their Gumball if this helps.
[/quote]Manually positioning objects without using reference points, lines, etc or snaps for accuracy leads to problems with joining, splitting, trimming, Boolean operations, etc.

Edited for clarity.


(David Cockey) #10

Determining the centerline of the original hole to align the new cylinder to may be difficult, depending on the orientation of the hole and how it was made.

If the axis of the original hole is known then it may be possible to use RoundHole to create a larger hole on the same axis directly, without creating an intermediate cylinder.


(David Cockey) #11

Terry, not all commands available in Rhinoscriptsyntax are available for command line entry or by clicking on an icon or drop down menu. Your approach of writing Python scripts for most operations is not common practice.


#12

I think you missed the section in the middle of my long post where I give a complete example using the Command line which only has access to regular tools. There you can see rs.AddCylinder has been replaced with Cylinder, a regular tool. The picture is from this Command-line-only case. I edited my long post to more clearly separate the two approaches.

I totally agree with you that aligning the cylinders may be challenging. But the creator of the shape may have all the details at hand.


(David Cockey) #13

Yes, I missed it.