How to make hole on surface chose of polysurface


I have many objects that need to make holes in the surface. The created object is the surface of the polysurface. Make the script to select the surface and enter the number of holes, the hole size will be like the attached image? Help me please
Thank you!

I think you should upload your 3dm file containing all the polysurface.
The program (GH or script) and algorithm depends on your polysurfaces’ shape and geometry feature.

1 Like

They have only 2 main types of surfaces: flat surfaces and curved surfaces.

Still no file upload here?

In your picture I will extract top surface which is easy.
then inner curve and outer curve of the top surface, easy too
tween curve between these 2 curve and the middle curve is ready.
extend the middle curve with some negative distance, lets say 10mm
the new curve has 2 end points, called A and B
and also extract the middle point of the curve, called C
draw circle on the ABC point with certain radius, such as 6mm
then I will split the top surface with these 3 circle and delete the surface inside the circle.
finally join the splited top surface and the remaining surface, which clearly create some open brep

is this what you want?
because from your picture these are all I got.


if so, other people will spend some time doing the program for you.
So are you sure you have nothing to add?
and no 3dm file?

1 Like

Thank you!
I found the surface selection method here: How to select surfaces in polysurface I needed to do the following: select the surface → import quantity, radius to make holes

I assume you don’t like to provide enough information yet still want others’ help.

import quantity and radius? from where? what quantity?

I quit. good luck later on.

Thank @11165
I don’t know what to upload because the input object is as shown on the picture. Select the surface, then input the number of holes, the hole diameter will give results

your whole question just doesn’t make any sense
1: from your previous post, the hole is only on top surface, but in your last pic, it appears in side.
2: what is the distribution of these holes? evenly?
3: what is the distance between end circle and surface border?

you are wasting other’s time by bad quality question here.

1 Like

1: from your previous post, the hole is only on top surface, but in your last pic, it appears in side. - surface is selected , not fixed.
2: what is the distribution of these holes? evenly? - center of surface and evenly
3: what is the distance between end circle and surface border? - about 10mm

sorry I don’t know how to describe them

Thank you

How to select surfaces in polysurface
this runs in rhino py script, but not in GH
I tried with python and C#, both lead to unresponse canvas

according to this post, not possible.

This might give you a starting point to work from:

import rhinoscriptsyntax as rs

obj = rs.GetObject("Select object", rs.filter.polysurface, False, True)
rs.EnableRedraw(False)

eobjs = rs.ExplodePolysurfaces(obj)

surfs = sorted(eobjs, key = lambda i: rs.SurfaceArea(i))
surfl = [surfs[2:4],surfs[4:6]]

div = rs.GetInteger("Enter number of holes:", 3)
div +=1
rad = rs.GetString("Enter hole radius:",str(2))
rad = float(rad)

cyls = []

for j in surfl:
    pnts = []
    mcsdir = []
    mcrvs = []
    for i in j:
        edgs = rs.DuplicateEdgeCurves(i)
        edgs = sorted(edgs, key = lambda i: rs.CurveLength(i))
        edg1 = edgs[2]
        rs.SimplifyCurve(edg1)
        edg2 = edgs[3]
        rs.SimplifyCurve(edg2)
        dir1 = rs.CurveNormal(edg1)
        dir2 = rs.CurveNormal(edg2)
        if dir1 != dir2 or (rs.IsLine(edg1) and rs.IsLine(edg2)):
            rs.ReverseCurve(edg1)
        mc = rs.MeanCurve(edg1,edg2,0.001)
        mcrvs.append(mc)
        mcsdir.append(rs.CurveNormal(mc))
        pnts.append(rs.DivideCurve(mc,div,False, True))
        rs.DeleteObjects(edgs)
    pnts1 = pnts[0][1:div]
    pnts2 = pnts[1][1:div]
    if mcsdir[0] != mcsdir[1] or rs.IsLine(mcrvs[0]):
        pnts2.reverse()
    rs.DeleteObjects(mcrvs)
    lnl = [rs.AddLine(k,m) for k,m in zip(pnts1, pnts2)]
    lnl = [rs.ExtendCurveLength(i,0,2,5) for i in lnl]
    for ln in lnl:
        cyls.append(rs.AddCylinder(rs.CurveStartPoint(ln), rs.CurveEndPoint(ln),rad))
    rs.DeleteObjects(lnl)

rs.BooleanDifference(obj, cyls, True)
rs.DeleteObjects(surfs)

rs.EnableRedraw(True)
1 Like

Thanks @Adam_M.
This is used with extrude object or close the polysurface. we need to select the surface in polysurface and make it

As I told you, not possible in GH, but probably possible in RhinoScript.