找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?在线3D打印服务,一键上传,自动报价 
查看: 15721|回复: 1
打印 上一主题 下一主题

UG二次开发利用极点创建曲线的问题,高手们请进!

[复制链接]
跳转到指定楼层
1
发表于 2006-9-4 21:30:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

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

x
试编了一小段程序,UG里运行dll时提示:“内存访问冲突”。
请教高手!是什么问题?

#include <uf.h>

#include <uf_ui.h>
#include <uf_curve.h>


#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
#        include <strstream>
#   include <iostream>
#   include <fstream>
#   include <string>

using namespace std;
        using std:strstream;
        using std::endl;        
        using std::ends;
        using std::cerr;
#else
#        include <strstream.h>
#   include <iostream.h>
#endif
#include "curves.h"

//----------------------------------------------------------------------------
//  Activation Methods
//----------------------------------------------------------------------------

//  Explicit Activation
//      This entry point is used to activate the application explicitly, as in
//      "File->Execute UG/Open->User Function..."
extern "C" 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 */

                /*create a new prt*/
                char part_name[133]="d:\\kk.prt";
                int units=1;
        tag_t part;
        UF_PART_new(part_name,units,&part);

             UF_CURVE_spline_t splinedata;
                tag_p_t splinetag;
                int *num_states;
        UF_CURVE_state_p_t *states=NULL;
splinedata.is_rational=1;
splinedata.num_poles=4;
splinedata.order=3;
splinedata.poles[0][0]=111;
splinedata.poles[0][1]=31;
splinedata.poles[0][2]=46;
splinedata.poles[0][3]=1;
splinedata.poles[1][0]=107;
splinedata.poles[1][1]=46;
splinedata.poles[1][2]=46;
splinedata.poles[1][3]=1;
splinedata.poles[2][0]=98;
splinedata.poles[2][1]=37;
splinedata.poles[2][2]=46;
splinedata.poles[2][3]=1;
splinedata.poles[3][0]=100;
splinedata.poles[3][1]=35;
splinedata.poles[3][2]=46;
splinedata.poles[3][3]=1;
      
               
UF_CURVE_create_spline (&splinedata,splinetag,num_states,states);



    }
        errorCode = UF_terminate();

    /* 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 "C" int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_UG_TERMINATE );
}

}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2006-9-5 15:31:41 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

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

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

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-9-22 19:26 , Processed in 0.024147 second(s), 13 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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