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

ruihuzhou@163.com 2015-03-09 08:47:41
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 );
}
}
...全文
816 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
mxway 2015-03-09
  • 打赏
  • 举报
回复
找nx的二次开发文档,看里面有没有例子。如果没有还可以用nx的录制功能,录制出nxopen的代码来做。不一定非要用这个函数。
ruihuzhou@163.com 2015-03-09
  • 打赏
  • 举报
回复
看过帮助文档,只有函数说明,没有给出实例。谢谢
源码链接: https://pan.quark.cn/s/0f7c75cb3aad ### MIPI Video Mode 与 Command Mode 的差异 #### 一、引言 MIPI (Mobile Industry Processor Interface) 是一种用于连接移动设备中处理器及其外围设备的标准化接口。MIPI 接口支持多种协议,其中包含 DSI (Display Serial Interface) 和 DCS (Display Control Interface) 等协议。在 MIPI 接口的应用中,主要涉及两种工作模式:Video Mode(视频模式)和 Command Mode(命令模式)。本文旨在系统性地阐述这两种模式的工作机制、特性以及实际应用环境。 #### 二、LCD RAM 概念说明 在进一步探讨 MIPI 的两种模式之前,有必要对文中提及的“LCD RAM”概念进行明确。实际上,“LCD RAM”并非一个通用术语,而是本文作者用来描述 LCD 控制器中用于存储显示数据的内存区域。LCD(Liquid Crystal Display,液晶显示屏)通常配备一个控制 IC(Integrated Circuit,集成电路),该控制 IC 可能内置 RAM 以缓存显示数据。 #### 三、MIPI Video Mode(视频模式) **定义:** - 视频模式是一种类似于传统 RGB 接口的工作模式,它要求主机持续不断地向显示器传输刷新数据。 - 在这种模式下,数据和控制信号以报文的形式通过 MIPI 总线进行传输。 - 显示器本身无需配备帧缓冲器,因为主机会周期性地刷新屏幕。 **特点:** 1. **实时性高:** 主机需要不...
源码下载地址: https://pan.quark.cn/s/a4b39357ea24 在电磁模拟技术中,CST(Computer Simulation Technology)是一种被广泛采纳的软件工具,它主要用于电磁场、微波、天线以及射频系统的设计工作。本资料将详细分析CST软件中离散端口的具体配置方法,这些方法对于提升仿真结果的精确度和专业水准具有决定性作用。离散端口在CST软件中扮演着模拟信号输入或输出的重要角色,它们构成了仿真模型不可或缺的部分。在配置离散端口时,一个核心的原则是保证端口的方向与网格线保持一致,这是因为这样做能够有效降低计算过程中产生的误差,并确保仿真数据的有效性。如果未能遵循这一指导原则,可能会引发未知的计算问题,进而导致仿真结果失去可靠性。 在CST软件中配置离散端口,通常需要借助“Pick Points”这一功能。通过选择“Pick Edge Center”选项,端口将被设定在模型边缘的中心位置上。然而,这种做法并不总是能够确保端口与网格线保持平行。在某些特定情形下,模型的几何构造可能不允许直接选取一个与网格线平行的边作为端口的安装位置。 为了克服这一挑战,可以采用多种不同的策略。如果模型本身已经包含一条与馈电口平行的边,那么可以直接利用这条边来建立端口,此时CST软件会自动调整端口使其与网格线对齐。另一种可选的方法是,当模型不具备现成的平行边时,用户可以手动构建一个几何结构,比如一个立方体,并使其边缘与馈电口平行。通过这种方式,新建立的几何结构的边缘就可以作为端口的位置,从而确保端口与网格线的平行关系。 在实施上述操作时,必须关注端口尺寸的合理性和物理意义的一致性。端口的尺寸应当依据实际天线馈电部分的尺寸进行适当调整,过大的端口或...

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧