Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

C++ UF_MODL functions not doing anything

Creator
Creator

Hi,

 

I am trying to get the mid point of a face in NXOpen C++. I collect the face in a BlockUI face collector (teFaceCollector). I know I have a face becasue I have another function that makes an offset surface using it that works.

 

What isn't working is the "UF_MODL_ask_face_uv_minmax()". It doesn't give an error, it just doesn't modify the uvMinMax array like it should and the array has its initialised values still. You can see from the commented "/*teFace.Tag()*/" inside this function that I have tried both a face.tag and a facepointer.tag

 

        //get mid point of TE

std::vector<TaggedObject*> pTETaggedObjs = teFaceCollector->GetSelectedObjects(); double uvMinMax[4]; NXOpen::Face* pFace = dynamic_cast<NXOpen::Face*>(pTETaggedObjs[0]);
NXOpen::Face &teFace = *pFace; UF_MODL_ask_face_uv_minmax(/*teFace.Tag()*/ pFace->Tag(), uvMinMax);

Can someone please help. I'm probably doing something silly but I'm stuck

 

Kind regards,

 

Nick

4 REPLIES 4

Re: C++ UF_MODL functions not doing anything

Legend
Legend

If you are working with C++. The standard approach is to use a UFCALL define enclosers.  That may help you what exact parameters needs to be passed. make sure you have added proper headers.

 

This is just a guess. 

 

#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))

 

伊尔凡

Re: C++ UF_MODL functions not doing anything

Creator
Creator

Thank you.

 

I had already moved to doing that, but you mentioning it again made me find another example that expanded on what I had, to include a listing window. From that I realiesed I hadn't called:

 

if (UF_CALL(UF_initialize())) return;

in my 

extern "C" DllExport void  ufusr(char *param, int *retcod, int param_len) { ... }

 

Thanks a bunch! It was just throwing a silent error I guess. I can continue with my project now Smiley Happy

Re: C++ UF_MODL functions not doing anything

Siemens Legend Siemens Legend
Siemens Legend

@NickG wrote:

It was just throwing a silent error I guess.


Only, if you disregard the return value from legacy Open C APIs (aka Ufunc, UGOpen, UF).

They usually return an integer value different than 0 in case of errors, see also

Open C Programmer's Guide -> Error Handling

 

 

 

Re: C++ UF_MODL functions not doing anything

Creator
Creator

Yes, sorry, I didn't mean there were no errors, becasue in the end I managed to get a Listing Window that told me I hadn't called the UF_Initialise. All I meant was nothing was breaking, and the code completed in CAD with no error.

 

Thanks for the link