+发表新主题
xjq1979 发布于2006-4-25 19:28 301 次浏览 14 位用户参与讨论
跳转到指定楼层
xjq1979 发表于 2006-5-21 17:30:41
// MoldKBE.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "MoldKBE.h"
#include "DlgCanshu1.h"
#include "Dlg2.h"
#include "DlgDP.h"

#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.
//

/////////////////////////////////////////////////////////////////////////////
// CMoldKBEApp

BEGIN_MESSAGE_MAP(CMoldKBEApp, CWinApp)
    //{{AFX_MSG_MAP(CMoldKBEApp)
        // 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()

/////////////////////////////////////////////////////////////////////////////
// CMoldKBEApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CMoldKBEApp object

CMoldKBEApp theApp;


/////////////////////////////////////////////////////////////////////////////
#include <uf_mb.h>
#include <odbcinst.h>

UF_MB_cb_status_t hanshu1();
UF_MB_cb_status_t hanshu2();
UF_MB_cb_status_t hanshu3();

static UF_MB_cb_status_t fun1(UF_MB_widget_t widget, UF_MB_data_t client_data, UF_MB_activated_button_p_t call_button)
{
    return hanshu1();
}
static UF_MB_cb_status_t fun2(UF_MB_widget_t widget, UF_MB_data_t client_data, UF_MB_activated_button_p_t call_button)
{
    return hanshu2();
}
static UF_MB_cb_status_t fun3(UF_MB_widget_t widget, UF_MB_data_t client_data, UF_MB_activated_button_p_t call_button)
{
    return hanshu3();
}

static UF_MB_action_t action_table[] =
{
    {"A1", fun1, NULL},
    {"A2", fun2, NULL},
    {"A3", fun3, NULL},
    {NULL, NULL, NULL}
};


extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    UF_initialize();

    UF_MB_add_actions(action_table);
   
    UF_terminate();
}



//----------------------------------------------------------------------------
//  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 );
}


extern "C" void ufusr_cleanup(void)
{
}



UF_MB_cb_status_t hanshu1()
{
    DlgCanshu1 dlg;
    dlg.DoModal();
    return UF_MB_CB_CONTINUE;
}



UF_MB_cb_status_t hanshu2()
{
    CDlgDP dlg;
    dlg.DoModal();
   

    return UF_MB_CB_CONTINUE;
}

UF_MB_cb_status_t hanshu3()
{

    return UF_MB_CB_CONTINUE;
}
回复

使用道具 举报

xjq1979 发表于 2006-5-21 17:31:47
#if !defined(AFX_DLGCANSHU1_H__4B04A600_DEBC_4BC0_B386_506F93690C28__INCLUDED_)
#define AFX_DLGCANSHU1_H__4B04A600_DEBC_4BC0_B386_506F93690C28__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgCanshu1.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// DlgCanshu1 dialog

class DlgCanshu1 : public CDialog
{
// Construction
public:
    DlgCanshu1(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
    //{{AFX_DATA(DlgCanshu1)
    enum { IDD = IDD_DIALOG_CANSHU1 };
    CComboBox    m_comb1;
    //}}AFX_DATA


// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(DlgCanshu1)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
    //{{AFX_MSG(DlgCanshu1)
    afx_msg void OnButton1();
    virtual BOOL OnInitDialog();
    afx_msg void OnButton2();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGCANSHU1_H__4B04A600_DEBC_4BC0_B386_506F93690C28__INCLUDED_)
回复

使用道具 举报

xjq1979 发表于 2006-5-21 17:33:10
// DlgCanshu1.cpp : implementation file
//

#include "stdafx.h"
#include "moldkbe.h"
#include "DlgCanshu1.h"
#include "Dlg2.h"
#include <uf_part.h>

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

/////////////////////////////////////////////////////////////////////////////
// DlgCanshu1 dialog


DlgCanshu1:lgCanshu1(CWnd* pParent /*=NULL*/)
    : CDialog(DlgCanshu1::IDD, pParent)
{
    //{{AFX_DATA_INIT(DlgCanshu1)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
}


void DlgCanshu1::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(DlgCanshu1)
    DDX_Control(pDX, IDC_COMBO1, m_comb1);
    //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(DlgCanshu1, CDialog)
    //{{AFX_MSG_MAP(DlgCanshu1)
    ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
    ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// DlgCanshu1 message handlers

void DlgCanshu1::OnButton1()
{
    // TODO: Add your control notification handler code here
    CDialog::OnOK();

    CDlg2 dlg;
    dlg.DoModal();
   
}

BOOL DlgCanshu1::OnInitDialog()
{
    CDialog::OnInitDialog();
   
    // TODO: Add extra initialization here
    m_comb1.ResetContent();
    m_comb1.AddString("25");
    m_comb1.AddString("30");

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}

void DlgCanshu1::OnButton2()
{
    // TODO: Add your control notification handler code here
    tag_t prt_tag;
//    UF_PART_open("c:a.prt", 1, &prt_tag);
//    UF_MODL_edit_exp("dia=20");
//    UF_MODL_edit_exp("height=2");
//    UF_MODL_Update();
}
回复

使用道具 举报

xjq1979 发表于 2006-5-21 17:34:06
// DlgDP.cpp : implementation file
//

#include "stdafx.h"
#include "moldkbe.h"
#include "DlgDP.h"
#include <uf_part.h>
#include <uf_modl.h>

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

/////////////////////////////////////////////////////////////////////////////
// CDlgDP dialog


CDlgDP::CDlgDP(CWnd* pParent /*=NULL*/)
    : CDialog(CDlgDP::IDD, pParent)
{
    //{{AFX_DATA_INIT(CDlgDP)
    //}}AFX_DATA_INIT
}


void CDlgDP:oDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CDlgDP)
    DDX_Control(pDX, IDC_COMBO2, m_height);
    DDX_Control(pDX, IDC_COMBO1, m_dia);
    //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgDP, CDialog)
    //{{AFX_MSG_MAP(CDlgDP)
    ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgDP message handlers

void CDlgDP::OnSelchangeCombo1()
{
    // TODO: Add your control notification handler code here
    UpdateData(TRUE);
    int index = m_dia.GetCurSel();

    m_height.ResetContent();
    if (index == 0)
    {
        m_height.AddString("1.0");
        m_height.AddString("1.5");
        m_height.AddString("2.0");
    }
    else if (index == 1)
    {
        m_height.AddString("3.0");
        m_height.AddString("3.5");
        m_height.AddString("4.0");
    }
}



void CDlgDP::OnOK()
{
    // TODO: Add extra validation here
    UpdateData(TRUE);
/*    int index1 = m_dia.GetCurSel();
    int index2 = m_height.GetCurSel();
    if (index1<0 || index2<0)
        return;
*/   
    UF_PART_load_status_t    part_status;
    tag_t pttag;
    UF_PART_open("D:learnUG 2.01.prt", &pttag, &part_status);
    if (part_status.statuses != NULL)
        UF_free(part_status.statuses);
    if (part_status.file_names != NULL)
        UF_free_string_array(part_status.n_parts, part_status.file_names);

/*    if (index1==0)
    {
        UF_MODL_edit_exp("dia=10");
        if (index2==0)
        {
            UF_MODL_edit_exp("height=1.0");
        }
        else if (index2==1)
        {
            UF_MODL_edit_exp("height=1.5");
        }
        else
        {
            UF_MODL_edit_exp("height=2.0");
        }
    }
*/
    UF_MODL_update();
    CDialog::OnOK();
}
回复

使用道具 举报

xjq1979 发表于 2006-5-21 17:36:20
[s:23]
回复

使用道具 举报

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

本版积分规则

QQ| Archiver|手机版|小黑屋| 碧波制图网 Stonespider

Copyright © 2021-2023 Kangli Wu   All Rights Reserved.

Powered by Discuz! X3.5( 苏ICP备18011607号-1 )

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