iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 20222|回复: 3
打印 上一主题 下一主题

求助函数UF_SF_create_disp_mesh的使用

[复制链接]
跳转到指定楼层
楼主
发表于 2014-6-17 18:10:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
请教一个函数UF_SF_create_disp_mesh  网格数据我有,我想在UG高级仿模块中通过调用该函数显示这个网格,我按照函数要求赋予参数值,可是在UG中提示外部库错误,不知道怎么回事,是我赋值错了还是使用该函数还有什么限制,求大神帮助,万分感谢,附上代码
         
#include "stdafx.h"
#include "test1.h"
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_curve.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_csys.h>
#include <uf_sf.h>
#include <uf_ui.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
        if(irc)
        {
                char err[133],messg[300];
                UF_get_fail_message(irc, err);
                sprintf(messg, "\n%s\nerror %d at linePt %d in %s\n%s",
                        err, irc, line, file, call);
                printf("%s\n", messg);
                strcpy(&messg[129], "...");
                uc1601(messg, TRUE);  /* Internal only - remove for external */
        }
        return(irc);
}
       static void do_ugopen_api(void)
{
        UF_SF_disp_mesh_t disp_mesh;
        tag_t  mesh_tag;
        disp_mesh.node_coords=new double[9][3];
        disp_mesh.node_ids=new int[9];
        disp_mesh.elem_ids=new int[4];
        disp_mesh.elem_node_ids = new int *[4];
      for (int i = 0; i < 4; i++)
      {
          disp_mesh.elem_node_ids = new int[4];
      }
        disp_mesh.elem_dimension=UF_SF_DIMENSION_2D;
        disp_mesh.num_elements=4;
        disp_mesh.num_nodes=9;
        disp_mesh.num_elem_nodes=4;
        disp_mesh.node_coords[0][0]=0.0;
        disp_mesh.node_coords[0][1]=0.0;
        disp_mesh.node_coords[0][2]=0.0;
        disp_mesh.node_coords[1][0]=1.0;
        disp_mesh.node_coords[1][1]=0.0;
        disp_mesh.node_coords[1][2]=0.0;
        disp_mesh.node_coords[2][0]=2.0;
        disp_mesh.node_coords[2][1]=0.0;
        disp_mesh.node_coords[2][2]=0.0;
        disp_mesh.node_coords[3][0]=2.0;        
        disp_mesh.node_coords[3][1]=1.0;        
        disp_mesh.node_coords[3][2]=0.0;        
        disp_mesh.node_coords[4][0]=2.0;        
        disp_mesh.node_coords[4][1]=2.0;
        disp_mesh.node_coords[4][2]=0.0;
        disp_mesh.node_coords[5][0]=1.0;
        disp_mesh.node_coords[5][1]=2.0;
        disp_mesh.node_coords[5][2]=0.0;
        disp_mesh.node_coords[6][0]=0.0;
        disp_mesh.node_coords[6][1]=2.0;
        disp_mesh.node_coords[6][2]=0.0;
        disp_mesh.node_coords[7][0]=0.0;
        disp_mesh.node_coords[7][1]=1.0;
        disp_mesh.node_coords[7][2]=0.0;
        disp_mesh.node_coords[8][0]=1.0;
        disp_mesh.node_coords[8][1]=1.0;
        disp_mesh.node_coords[8][2]=0.0;
        disp_mesh.node_ids[0]=0;        
        disp_mesh.node_ids[1]=1;        
        disp_mesh.node_ids[2]=2;        
        disp_mesh.node_ids[3]=3;        
        disp_mesh.node_ids[4]=4;        
        disp_mesh.node_ids[5]=5;        
        disp_mesh.node_ids[6]=6;
        disp_mesh.node_ids[7]=7;
        disp_mesh.node_ids[8]=8;
        disp_mesh.elem_ids[0]=0;
        disp_mesh.elem_ids[1]=1;
        disp_mesh.elem_ids[2]=2;
        disp_mesh.elem_ids[3]=3;
        disp_mesh.elem_node_ids[0][0]=0;
        disp_mesh.elem_node_ids[0][1]=1;
        disp_mesh.elem_node_ids[0][2]=8;
        disp_mesh.elem_node_ids[0][3]=7;
        disp_mesh.elem_node_ids[1][0]=1;
        disp_mesh.elem_node_ids[1][1]=2;
        disp_mesh.elem_node_ids[1][2]=3;
        disp_mesh.elem_node_ids[1][3]=8;
        disp_mesh.elem_node_ids[2][0]=8;
        disp_mesh.elem_node_ids[2][1]=3;
        disp_mesh.elem_node_ids[2][2]=4;
        disp_mesh.elem_node_ids[2][3]=5;
        disp_mesh.elem_node_ids[3][0]=7;
        disp_mesh.elem_node_ids[3][1]=8;
        disp_mesh.elem_node_ids[3][2]=5;
        disp_mesh.elem_node_ids[3][3]=6;
        UF_CALL(UF_SF_create_disp_mesh(&disp_mesh,&mesh_tag));
        UF_CALL(UF_SF_display_mesh (mesh_tag));
}

void ufusr(char *param, int *retcode, int param_len)
{
  if (!UF_CALL(UF_initialize()))
  {
    do_ugopen_api();
    UF_CALL(UF_terminate());
  }
}

int ufusr_ask_unload(void)
{
  return (UF_UNLOAD_IMMEDIATELY);
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
 楼主| 发表于 2014-6-17 18:11:29 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
板凳
 楼主| 发表于 2014-6-17 21:36:17 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
地板
发表于 2014-6-18 13:45:07 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-5-3 09:59 , Processed in 0.010940 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表