Hey Guys,
I’m very new to coding altough I have some experience with GH already.
For an uni project I generated a wavy (non-planar) NURBS surface which I want to cut multiple breps with. I thought about extruding it to become a solid brep and then to do an boolean difference: I was trying to somehow RhinoGeometry.Extrusion it but this is only working with (planar) curves. I also converted it into a Brep but don’t know how to conitnue further and I was thinking if I could maybe instead of creating a NURBS surface directly create a solid out of the points/polycurves I got but I don’t know how.
Do you guys have any suggestions? Maybe there is an possibility to cut/trim Breps with the NURBS surface directly?
If you need the script to follow here it is:
# import libries
import Rhino.Geometry as rg
import math
# definitions
s = 2.0
a = 1.5
d = 4
w = 0.3
dis = 0.3
plank_count = int(math.floor(x/(w+dis))-1)
# create lists
pts, nested_pts, my_polylines, planks_uncut, planks = [], [], [], [], []
# create 3D Points
for i in range (x):
sub_pts = []
for j in range (y):
k = (math.sin(i*i*i*i-i*i*i+i*i-i+a) + math.cos(j*j*j*j-j*j*j+j*j-j+a)) * s + 10
pt = rg.Point3d(i,j,k)
pts.append(pt)
# store into sublist
sub_pts.append(pt)
nested_pts.append(sub_pts)
# create polycurves
for i in nested_pts:
my_polyline = rg.Polyline(i)
my_polycurves = my_polyline.ToPolylineCurve()
my_polylines.append(my_polycurves)
# create NurbsSurface out of 3D Points
srf = rg.NurbsSurface.CreateFromPoints(pts, x, y, d, d)
# create planks
for i in range(0,plank_count):
Point0 = rg.Point3d(0,i*(w+dis),0)
Point1 = rg.Point3d(x,(i+1)*w+(i*dis),25)
plank_bbox = rg.BoundingBox(Point0, Point1)
plank_brep = rg.Brep.CreateFromBox(plank_bbox)
planks_uncut.append(plank_brep)
# cut planks with surface/polylines <-- <-- <-- <-- <-- <-- HOW?
# ¯\_(ツ)_/¯
"""
# cut planks with surface
for r in planks_uncut:
cutted_planks = rg.Brep.Trim(r, srf, 1)
cutted_planks = rg.Brep.CreateBooleanIntersection(r, Brep2, 1)
planks.append(cutted_planks)
"""