Help beginner python script (functions and classes)

Hello everyone! :slight_smile:

I am a beginner with Python for Rhino and I would need your help with the following script.
I am trying to generate “Tooth” in-between two surfaces that I would later extrude, it would look like this in the end:

model 30.12.3dm (9.9 MB)

Python script:
30.12 teeth program (6.4 KB)

In the Python script, I created two classes, one for the plates and one for the tooth in-between. I am now trying to figure out how to generate the tooth. I first intersected two surfaces/planes, to get the line in-between. Then I divided the line into multiple ones and in the function “Projectlines” I try to move those curves following a vector. But there are no concrete results and I can’t figure out where the problem is.

Also another issue: I have to select the curve in-between the two surfaces (in the function: ExtendCurveLenght) and I would like somehow to just use the curve I get from the previous operation, without having to select it. Didn’t manage either! :confused:

I would be very thankful if anyone could give me some cues and maybe solutions :slight_smile:

Happy holidays season and happy new Year!


Are looking to do something like box joints between two surfaces with your script?

Here are some issues that I saw right off the bat. There might still be others.

def Projectlines (self, line_ids, extrusion_depth):
    line_ids = []  # OVERRIDES line_ids WITH AN EMPTY LIST

    for id in line_ids:  # 
        points = rs.PolylineVertices(id)
        vector1 = rs.VectorCreate(points[0],  points[1])
        vector2 = rs.VectorCreate(points[0],  points[3])  # THERE IS NO points[3] SINCE LINES HAVE ONLY TWO VERTICES

        normal = rs.VectorCrossProduct(vector1, vector2)
        #target_points = rs.ProjectPointToSurface(points, surface_2, normal)
        #polyline_id = rs.AddPolyline(target_points)
        extrusion_vect = rs.VectorUnitize(normal) * extrusion_depth
        rs.MoveObject (id, extrusion_vect * 2)
        rs.AddLine(points[0], points[0] + extrusion_vect)

        return line_ids

Happy New Year!