Understanding a BRep in sample parser

I run a typical file through the sample parser and I get something like the following, but I am unclear about a lot of things like

  1. What are details of NurbsSurface as there does not appear to be any contol vectors?
  2. What is the difference between a On_PolyCurve and an On_LineCurve, they both seem to have just the same parameters
    3.What does domain mean?
    4.What does u & v on the NurbsSurface mean?
    5.What is a Trim and how is it different from an Edge?
    6)What are surface points start & end
    7)What are the details of a NurbsCurve as again there does not appear to be any control points
Object table:
      Object 0:
        object name = ""
        object uuid = 00000000-0000-0000-0000-000000000000
        object mode = normal
        object layer index = 0
        object material index = -1
        material source = layer material
        ON_Brep:
        surfaces:  2
        3d curve:  2
        2d curves: 5
        vertices:  2
        edges:     2
        trims:     5
        loops:     2
        faces:     2
        curve2d[ 0]: ON_PolyCurve domain(0,27.0982) start(0,4.99624) end(6,4.996
24)
        curve2d[ 1]: ON_LineCurve domain(4.99624,18) start(6,4.99624) end(6,18)
        curve2d[ 2]: ON_LineCurve domain(0,6) start(6,18) end(0,18)
        curve2d[ 3]: ON_LineCurve domain(-18,-4.99624) start(0,18) end(0,4.99624
)
        curve2d[ 4]: ON_PolyCurve domain(0,27.0982) start(3.00014,2.9604) end(3.
00014,2.9604)
        curve3d[ 0]: ON_NurbsCurve domain(0,27.0982) start(2.83377,0.00013836,-3
.29239) end(2.83377,0.00013836,-3.29239)
        curve3d[ 1]: ON_NurbsCurve domain(4.99624,18) start(2.83377,0.00013836,-
3.29239) end(11.9464,4.87653e-16,-9.08301)
        surface[ 0]: ON_NurbsSurface u(0,6) v(0.133211,18)
        surface[ 1]: ON_NurbsSurface u(0.90839,5.09168) v(0,3)
        vertex[ 0]: (2.833772 0.000138 -3.292392) tolerance(0.00440147)
          edges (0,1,0)
        vertex[ 1]: (11.946362 0.000000 -9.083012) tolerance(1e-06)
          edges (1)
        edge[ 0]: v0( 0) v1( 0) 3d_curve(0) tolerance(0.00440147)
          domain(0,27.0982) start(2.83377,0.00013836,-3.29239) end(2.83377,0.000
13836,-3.29239)
          trims (+0,+4)
        edge[ 1]: v0( 0) v1( 1) 3d_curve(1) tolerance(1e-06)
          domain(4.99624,18) start(2.83377,0.00013836,-3.29239) end(11.9464,4.87
653e-16,-9.08301)
          trims (+1,-3)
        face[ 0]: surface(0) reverse(1) loops(0)
          loop[ 0]: type(outer) 4 trims(0,1,2,3)
            trim[ 0]: edge( 0) v0( 0) v1( 0) tolerance(0.005,0.005)
              type(mated   ) rev3d(0) 2d_curve(0)
              domain(0,27.0982) start(0,4.99624) end(6,4.99624)
              surface points start(2.83377,0.00013836,-3.29239) end(2.83377,0.00
013836,-3.29239)
            trim[ 1]: edge( 1) v0( 0) v1( 1) tolerance(1e-06,1e-06)
              type(seam    -east side iso) rev3d(0) 2d_curve(1)
              domain(4.99624,18) start(6,4.99624) end(6,18)
              surface points start(2.83377,0.00013836,-3.29239) end(11.9464,4.87
653e-16,-9.08301)
            trim[ 2]: edge(-1) v0( 1) v1( 1) tolerance(0,0)
              type(singular-north side iso) rev3d(0) 2d_curve(2)
              domain(0,6) start(6,18) end(0,18)
              surface points start(11.9464,4.87653e-16,-9.08301) end(11.9464,4.8
7653e-16,-9.08301)
            trim[ 3]: edge( 1) v0( 1) v1( 0) tolerance(1e-06,1e-06)
              type(seam    -west side iso) rev3d(1) 2d_curve(3)
              domain(-18,-4.99624) start(0,18) end(0,4.99624)
              surface points start(11.9464,4.87653e-16,-9.08301) end(2.83377,0.0
0013836,-3.29239)
        face[ 1]: surface(1) reverse(0) loops(1)
          loop[ 1]: type(outer) 1 trims(4)
            trim[ 4]: edge( 0) v0( 0) v1( 0) tolerance(0.005,0.005)
              type(mated   ) rev3d(0) 2d_curve(4)
              domain(0,27.0982) start(3.00014,2.9604) end(3.00014,2.9604)
              surface points start(2.83377,0.00013836,-3.29239) end(2.83377,0.00
013836,-3.29239)

For more info on the BRep structure, see the link below. Not all data is shown in the print-out you give, but all the data is in the objects, also for the NurbsCurve. Check the headers of the OpenNURBS for more information too.

http://developer.rhino3d.com/guides/cpp/brep_data_structure/

A domain is the range in which the curve parameter t or the surface parameters u and v are allowed to vary. The start of the domain is the start of the curve; the end of the domain is the end of the curve. Similar for surfaces. For more info on parametric curves, like NURBS, see

A polycurve is a concatenation of multiple, individual curves, whereas a line-curve is basically a line connecting two points.

Many Thanks

Hi Keith,

U & V: In the lower right corner in Fig 1 you can see the two directions of a surface. Red is U and green is V. The directions may or may not coincide with X and Y in the world coordinate system. The surface can be rotated in any direction, therefore you should consider U and V being “local X and Y”. But be aware, they can be swapped and reversed in any of four directions).

Trim and Edge: The two surfaces to the left in the Fig 1 illustrates a trimmed surface. The Control Points remains being part of the “underlaying” (although not visible) surface even after the surface have been trimmed (one part being cut out and discarded).

The edges are the “true” edges of the original surface, whereas the trim is a local definition defining what has been trimmed away from the original. The original surface can be imagined by the control points extending far beyond the visible part of the surface. Many commands cannot operate on trimmed edges.

Surface Points: If this is referring to Control Points, then you can see on the surfaces that they come in rows and columns. A surface has at least two in each U and V direction (Start and End points, and often more points in between).

// Rolf

1 Like

Please could somebody remind me how to run the sample parser, I am on MacOS.

Clearly I have done this in the past but cannot remember how.

Thanks

Hi Keith,

Sorry, what is “sample parser”?

– Dale

I asked this question back in 2016 understanding-a-brep-in-sample-parser

And obviously used a sample parser back then.

Would like to use again if it still exists,

I think you pass it a 3DM file and it prints out the details of the records,

Hi @Keith_Sloan,

If you are building the openNURBS source, then just run/debug the example_read project that comes with the source.

If you using Rhino, use the List command.

– Dale