马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_disp.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_object_types.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
static void do_ugopen_api(void)
{
UF_FEATURE_SIGN sign = UF_NULLSIGN;
double block_orig[3] = {0.0,0.0,0.0};
char *block_len[3] = {"1","2","3"};
tag_t blk_obj;
UF_CALL(UF_MODL_create_block1(sign, block_orig, block_len, &blk_obj));
int type = 1;
int unit = 3;
int accuracy = 1;
int count = 1;
double acc_val[11] = {.01,0,0,0,0,0,0,0,0,0,0};
double density = 1.0;
double massprop[47];
double massprop_stat[13];
/* if sheet bodies were selected */
UF_CALL(UF_MODL_ask_mass_props_3d(&blk_obj,
count,
type,
unit,
density,
accuracy,
acc_val,
massprop,
massprop_stat));
char string[100];
double v=massprop[1];
sprintf(string,"%f",v);
UF_UI_open_listing_window();
UF_UI_write_listing_window(string);
}
/*ARGSUSED*/
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);
}
为什么 通过编译了,所得到的体积是一个负的实数呢?错误在哪里呢? |