I’ve recently exposed points for NurbsSurfaces in js.
You would do something like this:
//...
//assuming object is a Brep
const nurbsSurface = object.geometry().surfaces().get( 0 ).toNurbsSurface()
const points = []
const cnt_u = nurbsSurface.points().countU
const cnt_v = nurbsSurface.points().countV
for ( let u = 0; u < cnt_u; u ++ ) {
for ( let v = 0; v < cnt_v; v ++ ) {
// const pt4d = nurbssurface.points().get( u, v ) //this returns a ON_4dPoint which is [x,y,z,w]
// to get the 3d version, you can do [ x/w, y/w, z/w ]
// or use the following new method:
const pt3d = nurbssurface.points().getPoint( u, v ) // this returns a ON_3dPoint
const pt = new THREE.Vector3().fromArray( pt3d )
points.push( pt )
}
}
const cp_geometry = new THREE.BufferGeometry().setFromPoints( points )
const cp_material = new THREE.PointsMaterial( { color: 0xff0000, size: 5, sizeAttenuation: false } )
const cps = new THREE.Points( cp_geometry, cp_material )
scene.add( cps )
//...
Working on a sample to show all of this. Red pts are control points, black points are sampled off of the Surface
( object.geometry().surfaces().get( 0 )
):
Original surface in Rhino:
I will work on a few other things before preparing the next release, but you can try it now (for the next 15 days) by using this version: https://github.com/mcneel/rhino3dm/suites/12615008710/artifacts/675232449