I need to place "holes" at points (1000s) in a model


#1

I have a model, with 300+ surfaces folded flat, with intersection points – I want to place a circle/hole with centers at points, is there a way to do this for all points at once?


#2

You can try this script I wrote a long time ago. I occasionally still use it.

Option Explicit
'Script written by Damon Sidel
'Script copyrighted by Damon Sidel
'Script version Sunday, April 19, 2009 7:22:34 PM

Call CopyToPoints()
Sub CopyToPoints()
	
	Dim pts : pts = Rhino.GetPointCoordinates("Select points",True)
	If IsNull(pts) Then Exit Sub
	
	Dim	copyObj : copyObj = Rhino.GetObject("Select object to copy")
	If IsNull(copyObj) Then Exit Sub
	
	Dim copyObjOrigin : copyObjOrigin = Rhino.GetPointCoordinates("Select point at origin of object being copied")
	If IsNull(copyObjOrigin) Then Exit Sub
	
	Call Rhino.EnableRedraw(False)
	
	Dim arrPt
	If IsArray(pts) Then
		For Each arrPt In pts
			Call Rhino.CopyObject(copyObj,copyObjOrigin(0),arrPt)
		Next
	End If
	
	Call Rhino.EnableRedraw(True)

End Sub

And if you are unfamiliar with running a Rhinoscript:
http://wiki.mcneel.com/developer/macroscriptsetup


#3

thanks


#4

Ok so I only made it through half a semester of programming, am I correct in assuming that in the Call Copytopoints () ineed the object to be copied? my circle?

I have your script open in the rhino script editor, in the menu bar on left under curve methods there is addcircle, I am I on the right track?

Thanks


#5

figured it out, thanks for the script, works great

DeWitt


#6

Glad you figured it out and glad I could help!


#7

thanks again


#8

hey I have run into an issue with the curves generated from the script (which worked perfectly to place curves at points)

I saved the files to dxf/dwg for fabrication, for some reason their software cannot program the curves that were placed this way

When he copies the curve, the software can program just fine

Would there be any reason you can think of that the script could be generating curves in some non-regular way?

Thanks


#9

The curves should be exact copies of the original. You could try creating a few without the script and see if that causes problems. If it works without the script, then you know it is the script.


#10

One possibility is that the exported curves are not on z 0 plane. I’ve come across this before, where the CNC software didn’t see curves if they were not exactly on 0 plane and planar.


#11

Hey Ledisnomad,

I wonder if you could explain exactly how your script works? It is intriguing. If you have a surface or a solid with a series of points on it, does it place holes where those points were?

Thank you.

@ledisnomad


#12

Hi, cosmas.

It is a very simplistic script. You select one or more points, an object to be copied, and the origin of that object. The script then copies the object to each point. Not much to it.

To BrianM’s thought, if that’s true it would be easy to test. Draw three circles/holes: 1. at z=0 that is flat, 2. at a non-zero z value, but the circle is flat, and 3. a circle with center at z=0 but not flat. See which one works.

Another thought is the way you save the file to dwg. You may end up with splines in dwg format. I usually use the polyline or line formats when exporting to dwg from Rhino.


#13

hi Ledisnomad,

This sound good – but when you say circles/ holes… if I copy a circle to each point, does it then punch holes in to whatever surface/solid they are on?

I sometimes have to create perforated sheets of metal. Using the array tool or the replace object command to place the circles is no problem, but to punch holes is… you have to go in to each circle and punch it out one by one, right?

Thank you.

@ledisnomad


(Willem Derks) #14

Hi Cosmas

What I so is place the points on the surface; than copy (with a similar script) spheres with the correct diameter to those points.
Next select the surface, run Split and split with the spheres.
Note that after completion, all the split results are selected.
Now deselect (CRTL + click) only the surface you want to keep (leaving the cut outs selected) hit delete and delete the spheres.

-Willem


#15

This script only copies an object to a point. The original poster wanted to copies circles (which he called holes because I assume during fabrication he is using the circle as a path on a CNC router to cut out a hole) to a bunch of points.

If you want to model holes, you could do as Willem suggests. You could use Split or BooleanDifference.

If you are looking for something more automated, it would require a different script, but it sounds like you wouldn’t need it. A simple array of points on the surface, replace points with spheres, Split or BooleanDifference sounds like it would work. There are also a few other commands in the Solid Tools that might help: MakeHole, ArrayHole, etc.


#16

Awesome-- the spheres with boolean difference command is the perfect solution. I really appreciate it.

Thank you.

@willem @ledisnomad