×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Creating annotation using UFUNC

Creating annotation using UFUNC

Creating annotation using UFUNC

(OP)
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?

RE: Creating annotation using UFUNC

(OP)
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();
}

RE: Creating annotation using UFUNC

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();
}

RE: Creating annotation using UFUNC

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources