Dottore93
Automotive
- Oct 22, 2013
- 3
Hi @all,
Being quite a novice in UG/NX programming, I need to program an external application that reads in a .PRT file, traverses through the entities, converts all Faces to (trimmed) B-surfaces (Nurbs) and passes these to another format. Part of the code is a routine processFace as follows:
Since I haven't programmed yet all the basic surface conversions Plane->Nurbs, Cylinder->Nurbs etc., I would be happy to have a general conversion routine in UG/NX that would take a NXOpen::Face as input and create me a Nurbs surface from it, if possible without loss of geometric information (and for most of the basic surface types that IS mathematically possible).
Is there such a conversion routine in UG/NX? I have browsed the docs and this forum for several hours, but could not find any helpful hint. Sorry if this is a FAQ. Any help is appreciated!
Being quite a novice in UG/NX programming, I need to program an external application that reads in a .PRT file, traverses through the entities, converts all Faces to (trimmed) B-surfaces (Nurbs) and passes these to another format. Part of the code is a routine processFace as follows:
Code:
void processFace(NXOpen::Face* face, ...) {
// (...) misc initializations and checks
tag_t facetag = face->Tag();
UF_MODL_bsurface_s bsurf;
bool ok = (UF_MODL_ask_bsurf(facetag, &bsurf) == 0);
if (ok) { // filled bsurf successfully
processNurbsSurface(bsurf);
}
else { // no success, need to convert surface individually by its type
NXOpen::Face::FaceType type = face->SolidFaceType();
if (type == NXOpen::Face::FaceType::FaceTypePlanar) {
// get plane data from Face and build nurbs
}
else if (type == NXOpen::Face::FaceType::FaceTypeCylindrical ) {
// get cylinder data from Face and build nurbs
}
// and so on for all other possible basic surface types ...
...
else return;
}
// (...) now process the loops, get attributes etc.
UF_MODL_free_bsurf_data(&bsurf);
}
Since I haven't programmed yet all the basic surface conversions Plane->Nurbs, Cylinder->Nurbs etc., I would be happy to have a general conversion routine in UG/NX that would take a NXOpen::Face as input and create me a Nurbs surface from it, if possible without loss of geometric information (and for most of the basic surface types that IS mathematically possible).
Is there such a conversion routine in UG/NX? I have browsed the docs and this forum for several hours, but could not find any helpful hint. Sorry if this is a FAQ. Any help is appreciated!