Export data from a nurbs surface

Hello peolple!

I’m starting to work with isogeometric analysis and one problem I’m having is getting data of a NURBS surface. Basically, I need to create a 2D surface and export its control points, weights and knots vectors to a text file (if it is possible to obtain the connectivity of the elements, it would be very good!).
Could someone tell me how can I export this data?

Thank you!

Hello - a cheap way out is to run the List command - there may be enough there to help- otherwise a script may help.

Here’s a quick Python:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino


def test():
    
    id = rs.GetObject("Select a surface", 8, preselect=True)
    if not id: return
    
    srf=rs.coercegeometry(id).Faces[0].UnderlyingSurface()

    kU = 'Knots U: \n'
    kV = 'Knots V: \n'
    pts = 'Points: \n'
    
    for item in srf.KnotsU:
        kU += str(item) + '\n'
    for item in srf.KnotsV:
        kV += str(item) + '\n'
    for item in srf.Points:
        pts +=  str(item.Location)+'\n'
    
    rs.TextOut(str(kU) + '\n' + str(kV)+ '\n' + str(pts))
    
test()

-Pascal

1 Like

Pascal,

Thank you very much!

I’m going to test this method now.

-Rosicley

Pascal,

The script is working, but is it possible to obtain the weigth of each control point?
Weight is the last piece of data I need.

-Rosicley

With added weight:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino


def test():
    
    id = rs.GetObject("Select a surface", 8, preselect=True)
    if not id: return
    
    srf=rs.coercegeometry(id).Faces[0].UnderlyingSurface()

    kU = 'Knots U: \n'
    kV = 'Knots V: \n'
    pts = 'Points: \n'
    
    for item in srf.KnotsU:
        kU += str(item) + '\n'
    for item in srf.KnotsV:
        kV += str(item) + '\n'
    for item in srf.Points:
        pts +=  str(item.Location)+' Weight: '+str(item.Weight)+'\n'
    
    rs.TextOut(kU + '\n' + kV + '\n' + pts)
    
test()

Hello Rosicley
Did you find the answer to your question.
I am also having the same problem but the script keeps returning a weight of 1 associated with each control point.

Hello - do you know that the weight is different from 1? Can you post an example?

-Pascal

Say I want to create a 2d surface with a circular hole in the center or a notch at one of the edges.

So when I create the required geometry and export the file, recreating the mesh in IGA only gives me a rectangular surface.

surf1.3dm (54.2 KB)

Hello - all of the points in the surface are weighted at one - this is normal. I am not really sure what your question is.

-Pascal

I am trying to perform stress analyses on a planar surface with a hole in the center of the plate with the help of IGA. I wrote a MATLAB code for the same. But when I try to plot the NURBS surface in matlab with the obtained control points and knot vectors, I get a rectangular surface.

Hello - I don’t now if Matlab supports trimmed surfaces - it may not.

-Pascal

Hello Pascal
I wrote a code based on the usual NURBS equations.

Are the trimmed surfaces represented differently???

Which software did u use for IGA???