iCAx开思工具箱

标题: 焊接代码 [打印本页]

作者: yangtaofanlang    时间: 2009-8-11 10:12
标题: 焊接代码
下面是我编写的创建焊接标注的程序,但是执行后,只出现点,并未出现焊接标注,大家帮忙看看代码有什么问题,多谢!

/******************************************************************************
             Copyright (c) 1999 Unigraphics Solutions, Inc.
                       Unpublished - All Rights Reserved
*******************************************************************************/
/* This example creates a weld symbol. */
#include <stdio.h>
#include <string.h>
#include "uf.h"
#include "uf_defs.h"
#include "uf_drf.h"
#include "uf_curve.h"
void ufusr(char *param, int *retcod, int param_len)
{
   int status = 0;
   static double  origin[3] = {20.0, 0.0, 0.0};
   static double base_pt[3] = {20.0, 100.0, 0.0};
   //char **text=NULL;
   char *text[2]={NULL,NULL};
   //char text1[133];
   //strcpy(text1, "This is a LABEL.");
   tag_t base_pt_tag;
   tag_p_t weld_symbol_tag=NULL_TAG;
   UF_DRF_weld_symbols_p_t weld_symbol_data=NULL;
   UF_DRF_weld_sym_info_t        sym_info_top;
   UF_DRF_weld_sym_info_t        sym_info_bottom;
   UF_DRF_object_t object;
   char stat_msg[133];
   status = UF_initialize();
   if (!status)
   {
      /* initialize the object structures */
      UF_DRF_init_object_structure(&object);
      /* create a base point */
      status = UF_CURVE_create_point(base_pt, &base_pt_tag);
   }
   if (!status)
   {
      /* Creates the weld symbol */
    //sym_info_top.angle=text1;
   object.object_tag = base_pt_tag;
      object.object_view_tag = NULL_TAG;
      object.object_assoc_type = UF_DRF_end_point;
      object.object_assoc_modifier = UF_DRF_first_end_point;
    strcpy_s(sym_info_top.angle,133,"30");
    sym_info_top.contour_type = UF_DRF_WELD_CONVEX;
    sym_info_top.finish_type = UF_DRF_WELD_CHIP_FINISH;
    strcpy_s(sym_info_top.num_root_depth,133,"8");
    strcpy_s(sym_info_top.pitch,133,"30");
    strcpy_s(sym_info_top.size,133,"20");
    //sym_info_top.pitch = 30;
    //sym_info_top.size = 20;
    sym_info_top.size_code = UF_DRF_WELD_CODE_A;
    sym_info_top.weld_type = UF_DRF_WELD_BUTT_WITH_RE_SYMBOL;
    strcpy_s(sym_info_bottom.angle,133,NULL);
    sym_info_bottom.contour_type = UF_DRF_WELD_NONE;
    sym_info_bottom.finish_type = UF_DRF_WELD_NO_FINISH;
    strcpy_s(sym_info_bottom.num_root_depth,133,NULL);
    strcpy_s(sym_info_bottom.pitch,133,NULL);
    strcpy_s(sym_info_bottom.size,133,NULL);
    sym_info_bottom.size_code = UF_DRF_WELD_NO_CODE;
    sym_info_bottom.weld_type = UF_DRF_WELD_NO_SYMBOL;
        //text[0]=new char[133];
    //text[1]=new char[133];
     strcpy_s(text[0],133,"asdf");
     strcpy_s(text[1],133,"1234");
    weld_symbol_data->center_flag = 1;
    weld_symbol_data->extension = UF_DRF_WELD_SYM_EXT_DOG_LEG;
    weld_symbol_data->field_flag = 1;
    weld_symbol_data->ident_line_type = UF_DRF_WELD_SYM_IDENT_LINE_TOP;
    weld_symbol_data->num_lines = 2;
    weld_symbol_data->peripheral_flag = 1;
    weld_symbol_data->reference_text = text;
    weld_symbol_data->scale_factor = 100;
    weld_symbol_data->staggered_flag = 1;
    weld_symbol_data->sym_info_bottom = sym_info_bottom;
    weld_symbol_data->sym_info_top = sym_info_top;
    strcpy_s(weld_symbol_data->symbol_standard,31,"ISO");
      /*
   int UF_DRF_create_weld_symbol
  (
  double origin_3d [ 3 ] ,
  UF_DRF_leader_attach_type_t leader_attach_type,
  UF_DRF_object_p_t object,
  double model_pos_3d [ 3 ] ,
  UF_DRF_weld_symbols_p_t weld_symbol_data,
  tag_p_t weld_symbol_tag
  )
   */
   status = UF_DRF_create_weld_symbol(
          origin,
          UF_DRF_leader_attach_screen,
          &object,
          base_pt ,
          weld_symbol_data,
          weld_symbol_tag);
   }
   printf("UF_DRF_create_weld_symbol ");
   if (status)
   {
      UF_get_fail_message(status, stat_msg);
      printf("has ERROR %d: %s.\n", status, stat_msg);
   }
   else
      printf("is successful.\n");
   UF_terminate();

}




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3