Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Hi Can someone help in translating

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi
Can someone help in translating this code to vb
Thank you ln advanced.



/******************************************************************************
Copyright (c) 1999 Unigraphics Solutions, Inc.
Unpublished - All Rights Reserved

*******************************************************************************/
/*
The following UG/Open API program asks you for a part number,
and displays the configured revision of the specified part. It prints out
a list of all the configuration rules available on your system and tells
you your current configuration rule. Finally, it attempts to set your
configuration rule to "Working".
*/

#include <stdio.h>
#include <stdlib.h>
#include <uf_ugmgr.h>
#include <uf.h>
#define CHECK( func_ ) { int ifail_ = 0; char message[133]; ifail_ = (func_); if ( ifail_ != 0 ) { UF_get_fail_message( ifail_, message ); printf("ERROR: %s returned from %s\n", message, # func_); return ifail_; } }
int main(int argc, char *argv[])
{
int ifail = 0;
int num_rules;
char** config_rules;
char current_rule[UF_UGMGR_NAME_SIZE+1];
int i;
UF_UGMGR_tag_t part_tag;
UF_UGMGR_tag_t config_part_rev_tag;
char part_number[UF_UGMGR_NAME_SIZE+1];
char rev_id[UF_UGMGR_NAME_SIZE+1];
ifail = UF_UGMGR_initialize(argc,(const char**)argv);
if (ifail != 0)
{
printf("ERROR: Failed to initialize with error code %d",
ifail);
exit(1);
}
printf("Enter part number :\n");
scanf("%s", part_number );
CHECK( UF_UGMGR_list_config_rules( &num_rules, &config_rules ) );
printf("AVAILABLE CONFIGURATION RULES:\n\n");
for ( i = 0; i < num_rules; i++ )
{
printf("%s\n", config_rules);
}
CHECK( UF_UGMGR_ask_config_rule( current_rule ) );
printf("\nCURRENT CONFIGURATION RULE: %s\n", current_rule );
CHECK( UF_UGMGR_ask_part_tag( part_number, &part_tag ) );
CHECK( UF_UGMGR_ask_configured_rev( part_tag, &config_part_rev_tag ) );
CHECK( UF_UGMGR_ask_part_revision_id( config_part_rev_tag, rev_id ) );
printf("\nCONFIGURED REVISION OF PART %s: %s\n", part_number,
rev_id );
CHECK( UF_UGMGR_set_config_rule( "Working" ) );
CHECK( UF_UGMGR_ask_config_rule( current_rule ) );
printf("\nCURRENT CONFIGURATION RULE: %s\n", current_rule );
UF_UGMGR_terminate();
return 0;
}
 
Replies continue below

Recommended for you

Code:
/******************************************************************************
             Copyright (c) 1999 Unigraphics Solutions, Inc.
                       Unpublished - All Rights Reserved

*******************************************************************************/
/*
The following UG/Open API program asks you for a part number,
and displays the configured revision of the specified part. It prints out
a list of all the configuration rules available on your system and tells
you your current configuration rule. Finally, it attempts to set your
configuration rule to "Working".
*/

#include <stdio.h>
#include <stdlib.h>
#include <uf_ugmgr.h>
#include <uf.h>
#define CHECK( func_ )   { int  ifail_ = 0;   char message[133];   ifail_ = (func_);   if ( ifail_ != 0 ) {     UF_get_fail_message( ifail_, message );     printf("ERROR: %s returned from %s\n", message, # func_);     return ifail_; } }
int main(int argc, char *argv[])
{
  int             ifail = 0;
  int             num_rules;
  char**          config_rules;
  char            current_rule[UF_UGMGR_NAME_SIZE+1];
  int             i;
  UF_UGMGR_tag_t  part_tag;
  UF_UGMGR_tag_t  config_part_rev_tag;
  char            part_number[UF_UGMGR_NAME_SIZE+1];
  char            rev_id[UF_UGMGR_NAME_SIZE+1];
  ifail = UF_UGMGR_initialize(argc,(const char**)argv);
  if (ifail != 0)
  {
    printf("ERROR: Failed to initialize with error code %d",
 ifail);
    exit(1);
  }
  printf("Enter part number :\n");
  scanf("%s", part_number );
  CHECK( UF_UGMGR_list_config_rules( &num_rules, &config_rules ) );
  printf("AVAILABLE CONFIGURATION RULES:\n\n");
  for ( i = 0; i < num_rules; i++ )
  {
    printf("%s\n", config_rules[i]);
  }
  CHECK( UF_UGMGR_ask_config_rule( current_rule ) );
  printf("\nCURRENT CONFIGURATION RULE: %s\n", current_rule );
  CHECK( UF_UGMGR_ask_part_tag( part_number, &part_tag ) );
  CHECK( UF_UGMGR_ask_configured_rev( part_tag, &config_part_rev_tag ) );
  CHECK( UF_UGMGR_ask_part_revision_id( config_part_rev_tag, rev_id ) );
  printf("\nCONFIGURED REVISION OF PART %s: %s\n", part_number,
  rev_id );
  CHECK( UF_UGMGR_set_config_rule( "Working" ) );
  CHECK( UF_UGMGR_ask_config_rule( current_rule ) );
  printf("\nCURRENT CONFIGURATION RULE: %s\n", current_rule );
  UF_UGMGR_terminate();
  return 0;
i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor