UG二次开发---UF_MODL_create_fitted_spline();函数的应用

ruihuzhou@163.com ruihuzhou@163.com 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
UG二次开发,VC6.0 UG6.0 通过点生成样条曲线 采用函数UF_MODL_create_fitted_spline(SPLINE_FIT_p_t spline_data,double *max_err,int *max_err_pt ,tag_p_t obj_id)。
但是SPLINE_FIT_p_t 这种数据结构不会用,请指导。
附录 源程序
// ugopen.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "ugopen.h"

#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_curve.h>
#include<uf_modl.h> //建模

#define NUMBER_POINTS 5
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//

/////////////////////////////////////////////////////////////////////////////
// CUgopenApp

BEGIN_MESSAGE_MAP(CUgopenApp, CWinApp)
//{{AFX_MSG_MAP(CUgopenApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUgopenApp construction

CUgopenApp::CUgopenApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CUgopenApp object

CUgopenApp theApp;

// ufusr()是直接激活的用户出口
// param retcode 是输出参数,rlen是指参数param的长度,由NX系统自动处理
//给出了一个函数的范例 可以写成子函数的形式 也方便调试 自己先定义一个子函数
static void do_ugopen_api(void)
{


SPLINE_FIT_p_t spdata; //截面点数据

double sp1;

double pt[15]={1.1000, 0.5320, 2.0000,
1.5240, 0.6789, 2.3000,
2.0000, 0.9000, 3.5956,
2.3456, 1.3456, 3.7890,
3.1000, 2.4567, 3.3214};
int err_pt;
int i;
tag_p_t curved_id;
spdata->degree=3;
spdata->num_of_points=5;
spdata->num_of_segments=1;
//spdata坐标的注释
// points
// double *
//
// coordinates for the points to be fitted.
// points[0~2] = (x, y, z) for the 1st point,
// points[3~5] = (x, y, z) for the 2nd point,
// ...



for(i=0;i<15;i++)
{
spdata->points[i]=pt[i]; //这个不会用? 求指导
}

//通过点的样条曲线
UF_MODL_create_fitted_spline(spdata,&sp1,&err_pt,curved_id);

}

extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize(); //初始化 获得权限

if ( 0 == errorCode )
{
/* TODO: Add your application code here 添加如下代码*/
AFX_MANAGE_STATE(AfxGetStaticModuleState()); //切换模块状态

do_ugopen_api(); //调用该程序

/* Terminate the API environment */
errorCode = UF_terminate(); //释放NX执行许可权限
}
/* Print out any error messages */
PrintErrorMessage( errorCode );
}
/*****************************************************************************
** Utilities
*****************************************************************************/

/* Unload Handler
** This function specifies when to unload your application from Unigraphics.
** If your application registers a callback (from a MenuScript item or a
** User Defined Object for example), this function MUST return
** "UF_UNLOAD_UG_TERMINATE". */
extern int ufusr_ask_unload( void ) //卸载函数
{
return( UF_UNLOAD_IMMEDIATELY );
}

/* PrintErrorMessage
**
** Prints error messages to standard error and the Unigraphics status
** line. */
static void PrintErrorMessage( int errorCode ) //错误输出
{
if ( 0 != errorCode )
{
/* Retrieve the associated error message */
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
UF_UI_set_status( message );
fprintf( stderr, "%s\n", message );
}
}
...全文

相关推荐

UG\NX二次开发 创建样条曲线 UF_MODL_create_fitted_spline

UG\NX二次开发 创建样条曲线 UF_MODL_create_fitted_spline。

王牌飞行员_里海

【例0702】create fitted spline 创建拟合样条线

create fitted spline 创建拟合样条线》这是一个NX二次开发官方小例子,下面是代码和解析。相较于混乱、未经验证的代码,官方案例能够确保开发者获得准确的开发方法,这些官方示例代码经过严格测试,能够正确地反映出NX软件的功能和API使用方式,有助于开发者系统地掌握NX二次开发技能,提高开发质量和效率。本专栏订阅后是永久阅读的。欢迎一起学习NX二次开发案例,逐步积累宝贵的经验,早日成为行业专家。

王牌飞行员_里海

CISP-CSE注册云安全工程师备考资源包基础教程

随着云计算技术的普及,云安全已成为网络安全领域的核心议题。CISP-CSE(注册云安全工程师)认证由中国信息安全测评中心颁发,旨在培养具备云安全专业知识和实践能力的实战型人才。本教程将结合"CISP-CSE注册云安全工程师备考资源包",系统性地为您梳理云安全的核心知识体系,并提供实战案例分析,助您高效备考。

t0_54coder

绘图模拟:在冲动环境中固定时间的示例 附matlab代码.rar

绘图模拟:在冲动环境中固定时间的示例 附matlab代码.rar

天天Matlab科研工作室

基于规则的电动汽车混合能源管理系统,采用MATLAB、Simulink、Simscape Electrical和Stateflow。.zip

1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。

海神之光
评论 2
收藏 已收藏
分享
返回顶部
ruihuzhou@163.com
C++ 语言 65,214 成员 250,514 内容