Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating annotation using UFUNC

Status
Not open for further replies.

man2007

Aerospace
Joined
Nov 6, 2007
Messages
283
Location
IN
I wrote following code to add add Annotation in drafting using ufunc, but when I call the dll file in unigraphics, it is not creating annotation.


#include <stdio.h>
#include <uf.h>
#include <uf_drf.h>
#include <uf_defs.h>
#include <string.h>


void ufusr(char *param, int *retcode, int paramLen)
{
tag_t note_obj;
int orient1=0;
static double origin1[3]={10.0,10.0,0.0};
char st[2][50];
UF_DRF_object_t object;

UF_initialize();
UF_DRF_init_object_structure(&object);
object.object_tag=note_obj;
strcpy(st[0], "a");
strcpy(st[1], "b");
UF_DRF_create_note(2,st,origin1,orient1,&note_obj);
UF_terminate();
}


Any ideas?
 
Sorry, I posted the wrong one. Please read the code as below

#include <stdio.h>
#include <uf.h>
#include <uf_drf.h>
#include <uf_defs.h>
#include <string.h>


void ufusr(char *param, int *retcode, int paramLen)
{
tag_t note_obj;
int orient1=0;
static double origin1[3]={10.0,10.0,0.0};
char st[2][50];

UF_initialize();
strcpy(st[0], "a");
strcpy(st[1], "b");
UF_DRF_create_note(2,st,origin1,orient1,&note_obj);
UF_terminate();
}
 
It works :)
Please copy only inside code;

If String is know you can use
st[0] = "a"; instead
st[0] = new char [100];
strcpy(st[0], "a");



void test(void)
{
tag_t note_obj;
int orient1=0;
static double origin1[3]={10.0,10.0,0.0};
char *st[2] ;
st[0] = new char [100];
st[1] = new char [100];


UF_initialize();
strcpy(st[0], "a");
strcpy(st[1], "b");
UF_DRF_create_note(2,st,origin1,orient1,&note_obj);

if( st[0] ) delete st[0];
if( st[1] ) delete st[1];
UF_terminate();
}
 
Thanku Siwy,

st[0] = "a"; worked fine!!


I have one more question,


I have created a dialog, called Dialog1.dlg and in the Dialog1_Apply_cb function I am adding a point contructor function (to get the point location from the user). For that I am using any one of the following commands

1)UF_UI_point_construct ("Enter point",&base_method,&point_tag,base_pt,&response);

or

2)uc1615 ("Enter location", base_pt );

or

3)uc1616 ("Enter location",&ia2,ip3,base_pt);

and the variables are declared as follows :

UF_STYLER_item_value_type_t data;
UF_UI_POINT_base_method_t base_method;
tag_t point_tag;
int orient1=0,response,ia2,ip3=0;
static double base_pt[3];

When I call .dll file, the above mentioned functions are not popping up the dialog boxes.

I checked the returned vales from uc1615 and uc1616, both returned 8. The value 8 means "Disallowed state, unable to bring up dialog"

The function UF_UI_point_construct returned the value 119001

What might be wrong?

Note that the above 3 functions worked fine in other files but not in the callback function that I have mentioned.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top