cancel
Showing results for 
Search instead for 
Did you mean: 

UF_BREP_make_body from face with G1-discontinuous bsurface?

Experimenter
Experimenter

Hello,

 

I need to generate a body from bsurfaces (NURBS surfaces) which may have G1 or C1 discontinuities. My C/C++ approach is as follows:

 

// Generate a face topology with no loops
UF_BREP_topology_t* face = (UF_BREP_topology_t*) UF_allocate_memory(sizeof(UF_BREP_topology_t), 0);
UF_BREP_INITIALIZE_TOPOLOGY(face, NULL, 0, UF_BREP_FACE_TOPO);

// Generate a bsurface geometry
UF_BREP_geometry_t nurbs;
nurbs.type = UF_BREP_BSURFACE_GEOM;
... (assign the nurbs data like knot vector, control points and so on

// attach the nurbs geometry to the face topology
int split[1] = { UF_BREP_SPLIT_OPTION };
UF_BREP_options_t options = { 1, split, NULL };
UF_BREP_attach_geometry(face, &nurbs, UF_BREP_ORIENTATION_FORWARD, &options, &nstates, &states);

// Make body from face
tag_t bodyTag = NULL_TAG;
UF_BREP_make_body(face, &bodyTag, &nstates, &states);

 

This works fine for smooth bsurfaces. Alas, for surfaces with C1 or G1 discontinuities the resulting body will only contain one continuous patch of the surface. The "split" option doesn't seem to have any effect at all. The "states" array reveals no errors or warnings.

 

According to the documentation of UF_BREP_make_body in uf_brep.h, splitting the bsurface in its continuous components and attaching each of these components individually to the face would probably do the job. But I don't know how to perfom that preprocessing step. Is there a api call that would do the splitting? Or at least an api call that would check a bsurface for such discontinuities? I could also program it but would like to avoid the work.

 

Or is there a totally different approach? I know there is some nurbs routines in the UF_MODL lib but (for certain reasons that go beyond this post) I would like to stay within UF_BREP if possible.

4 REPLIES

Re: UF_BREP_make_body from face with G1-discontinuous bsurface?

Valued Contributor
Valued Contributor

Automating a process is one thing, defining the process is another.  It looks to me you still have to define how to perform your task in NX, which would be to make a body from b-surfaces with G1 discontinuities.  I would first try to solve the problem by hand in NX and this might lead you to another forum.

 

When you have the required steps to solve your problem in NX, try to record them in a journal.  Hopefully, all commands you need will be journalled and then you will have a skeleton to start your automation work.

 

Do not forget the Open C interface is no longer enhanced, you only have access to old NX functionalities in it.  You will probably find a solution using the NX Open interface, which is the one being constantly enhanced and updated from release to release.

Re: UF_BREP_make_body from face with G1-discontinuous bsurface?

Siemens Phenom Siemens Phenom
Siemens Phenom

I don't think there are any functions in UF_BREP that will help you do the splitting. UF_BREP is all about topology (faces, loops, fins, etc.) and what you're trying to do is fundamentally geometric in nature.

 

If you don't want to use the UF_MODL functions, then you'll need to do some mathematics yourself, I think, or find some helper code. Basically, you do surface splitting by doing repeated knot insertion. I'd recommend looking at "The NURBS Book" by Piegl and Tiller. It provides a function called SurfaceKnotIns (which does knot insertion), and it shows how this function can be used to split a surface. There are other free NURBs libraries floating around the net, too, of varying quality.

 

SNAP also has some nice functions for constructing NURB surfaces, but then you'll need to write your code in VB or C# or managed C++. And if you can't use UF_MODL, then maybe you can't use SNAP, either.

山田
yamada

Re: UF_BREP_make_body from face with G1-discontinuous bsurface?

Experimenter
Experimenter

@MayaHTT_Etienne and Yamada: Thank you both for your replies!

 

@Maya: That's an interesting way to approach the problem from a completely different point of view. Unfortunately, I needed to start with the API programming and didn't have much time to learn a lot about NX and its interface itself. Not an optimal situation, that's for sure. As about the NXOpen C++ vs. the "old" Open C interface, my impression up to now is that some tasks (for example manipulation of parametric trim curves) still can't be performed very well with NXOpen.

 

@Yamada: Yes, UF_BREP is all about topology, but as a central function like UF_BREP_make_body does major geometry changes (in this case: replace a non-G1 bsurface with one of its G1 components) I was hoping there could be a way to influence that behaviour, for example via the UF_BREP_SPLIT_OPTION flag (which doesn't seem to affect anything). Anyway, thanks for confirming me there's nothing what I look for in UF_BREP.

As about the nurbs mathematics, that's not the problem. I am very familiar with that concept and have access to lots of nurbs manipulation routines. Of course I could expand any nurbs surface to maximum knots and then extract its G1-smooth bezier component patches. However, since in my area of work (automotive lighting) non-G1 nurbs surfaces with hundreds of bezier patch components are not uncommon (like the one in the attached picture which shows a detail of a reflector and is in fact just one single nurbs surface), I would like to avoid any unnessesary decomposition steps.

I will probably need a function that subdivides a given nurbs surface in as few as possible G1-smooth continuous patches, which is not so easy because it would need to detect discontinuities. I think I will have a closer look at UF_MODL.

Re: UF_BREP_make_body from face with G1-discontinuous bsurface?

Siemens Phenom Siemens Phenom
Siemens Phenom

> I will probably need a function that subdivides a given nurbs surface

> in as few as possible G1-smooth continuous patches

 

Yes, that's what I had in mind. I agree that you don't want to split the surface up into all of its individual Bezier patches.

 

> not so easy because it would need to detect discontinuities

 

Here's an approach that might not be too hard. Let's suppose the surface has degree 3, just to make the explanation easier. First look at the knot multiplicities. If a knot has multiplicity 2 or less, then the surface must be C1 there (as you probably know), so you can ignore those places. Next look at knots of multiplicity 3. At these places, the surface may or may not be C1. So, reduce the knot multiplicity by 1 (you'll need a knote removal function) and compare the deviation between the new surface and the original. NX has a Deviation Checking function, but you can easily write a more efficient one yourself. If the two surfaces are S1 and S2, you just check that S1(u,v) = S2(u,v) at some sample set of (u,v) locations. You don't need a large set of sample locations -- a 4 x 4 set is enough on a surface of dgreee 3 x 3.

山田
yamada