zoukankan      html  css  js  c++  java
  • 《proe 二次开发01》

    【1.】 "protected: virtual struct AFX_MSGMAP const * __thiscall SelectDLG::GetMessageMap(void)const "

    出现这个原因是因为创建一个新类时,不能设置基类为CObject,随便选择了一个基类,然后,在将其改为CObject。“MSGMAP”这个词出现在了错误中,说明与MessageMap有关
    【解决方法】:
    1.“DECLARE_MESSAGE_MAP()”就是因为多加了一句这个,删除这一句。
    2.DECLARE_MESSAGE_MAP()”必须配合以下语句使用不出现上述问题

    BEGIN_MESSAGE_MAP(Ctest2App, CWinApp)
    END_MESSAGE_MAP()

    【2.】无法解析的外部符号

    【解决方法】:

    查看配置是否正确;
    用到的函数是否声明,是否定义,及其函数名字书写是否正确

    【3.】按钮菜单不显示,加载辅助程序时崩溃。
    【解决方法】:
    首先,查看信息文本中四行信息,第一行一定是英文状态,与函数代码中一致(结果显示的是第二行中文名字),
    其次,一定注意,第一行信息,必须都不相同,不要简单的粘贴复制之后,不修改。

    【4.】vc++2010环境下设置release 可调式:
    设置在Release模式下调试的方法:
    1.工程项目上右键 -> 属性
    2.c++ -> 常规 -〉调试信息格式 选 程序数据库(/Zi)或(/ZI), 注意:如果是库的话,只能(Zi)
    3.c++ -> 优化 -〉优化 选 禁止(/Od)
    4.连接器 -〉调试 -〉生成调试信息 选 是 (/DEBUG)

    【5.】

    UpdateData(TRUE) 是将控件的状态传给其关联的变量,当然你要为控件关联上变量才行。
    UpdateData(FALSE) 是将控件的关联变量的值传给控件并改变控件状态。
    UpdateData 刷新的是当前对话框。


    【6】读取TXT文档的函数代码
    ProPath text_path;
    char path[PRO_PATH_SIZE], note_path[PRO_PATH_SIZE];
    CStdioFile fp;
    CString str1;
    CString strTech;
    SCommonTolData CommonTolData;//常用公差数据

    //在text文件夹下的ct.txt文件中保存常用公差
    ProToolkitApplTextPathGet(text_path);
    ProTKSprintf(note_path,_T("%0s\text\"), ProWstringToString(path, text_path));
    strTech=CString(note_path)+_T("ct.txt");
    fp.Open(strTech,CFile::modeRead|CFile::typeText);
    //读取公差的设置,各参数值之间用逗号分隔
    while(fp.ReadString(str1))
    {
    int index=0;
    //第1个参数
    str1.Format(_T("%s"),str1);
    if((index = str1.Find(",")) != -1)
    {
    CommonTolData.tolCName=str1.Left(index);
    str1=str1.Mid(index+1,str1.GetLength());
    }
    //第2个参数
    if((index = str1.Find(",")) != -1)
    {
    CommonTolData.tolEName=str1.Left(index);
    str1=str1.Mid(index+1,str1.GetLength());
    }
    //第3个参数
    if((index = str1.Find(",")) != -1)
    {
    CommonTolData.upperLimit=atof(str1.Left(index));
    str1=str1.Mid(index+1,str1.GetLength());

    }
    //第4个参数
    if((index = str1.Find(",")) != -1)
    {
    CommonTolData.lowerLimit=atof(str1.Left(index));
    str1=str1.Mid(index+1,str1.GetLength());
    }
    //第5个参数和第6个参数
    if((index = str1.Find(",")) != -1)
    {
    int tolType_index=0;
    tolType_index=atoi( str1.Left(index));
    switch (tolType_index)
    {
    case 0:
    CommonTolData.tolType=PRO_TOL_LIMITS;//限制
    break;
    case 1:
    CommonTolData.tolType=PRO_TOL_PLUS_MINUS;//加-减
    break;
    case 2:
    CommonTolData.tolType=PRO_TOL_PLUS_MINUS_SYM;//+-对称
    break;
    case 3:
    CommonTolData.tolType=PRO_DIM_TOL_SYM_SUPERSCRIPT;//+-对称上标
    break;
    default:
    return;
    }
    CommonTolData.tolDecimal=atoi(str1.Mid(index+1,str1.GetLength()));
    }
    CommonTolArray.Add(CommonTolData);
    }
    fp.Close();

    【7】fin.getline(sentence, 100);

    第一个参数显然是用来接受的char数组.
    第二个参数是在遇到换行符之前,数组允许接受的最大元素数量.


    【8.】 "protected: virtual struct AFX_MSGMAP const * __thiscall SelectDLG::GetMessageMap(void)const "

    出现这个原因是因为创建一个新类时,不能设置基类为CObject,随便选择了一个基类,然后,在将其改为CObject。“MSGMAP”这个词出现在了错误中,说明与MessageMap有关
    【解决方法】:
    1.“DECLARE_MESSAGE_MAP()”就是因为多加了一句这个,删除这一句。
    2.DECLARE_MESSAGE_MAP()”必须配合以下语句使用不出现上述问题

    BEGIN_MESSAGE_MAP(Ctest2App, CWinApp)
    END_MESSAGE_MAP()

    【9.】无法解析的外部符号

    【解决方法】:

    查看配置是否正确;
    用到的函数是否声明,是否定义,及其函数名字书写是否正确

    【10.】按钮菜单不显示,加载辅助程序时崩溃。
    【解决方法】:
    首先,查看信息文本中四行信息,第一行一定是英文状态,与函数代码中一致(结果显示的是第二行中文名字),
    其次,一定注意,第一行信息,必须都不相同,不要简单的粘贴复制之后,不修改。

    【11.】读取线缆装配体显示在树形控件中

    BOOL CDlg_Manager_AsmInfo::OnInitDialog()
    {
    CDialog::OnInitDialog();

    // TODO: 在此添加额外的初始化
    m_AsmInfo_tab.AddPage(_T("装配特征"),&m_AF_page,IDD_Manager_AF);
    m_AsmInfo_tab.AddPage(_T("装配连接"),&m_AL_page,IDD_Manager_AL);
    m_AsmInfo_tab.AddPage(_T("关键特性"),&m_KC_page,IDD_Manager_KC);
    m_AsmInfo_tab.Show();

    BOOL bb = UpdateTreeList();

    return bb; // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
    }

    BOOL CDlg_Manager_AsmInfo::UpdateTreeList()
    {
    ProError status;
    ProName name;
    status=ProMdlCurrentGet((ProMdl*)&asm_solid);
    if (status!=PRO_TK_NO_ERROR)
    {
    SendMessage(WM_CLOSE);
    return FALSE;
    }
    ProMdlNameGet(asm_solid,name);

    m_AsmInfo_tree.DeleteAllItems();
    HTREEITEM hroot = m_AsmInfo_tree.InsertItem(cur_component->c_cur_asm_name,0,0,TVI_ROOT);
    m_AsmInfo_tree.SetItemData(hroot,0);

    p_asmfeatlist.RemoveAll();
    ShowModelTree(asm_solid,m_AsmInfo_tree,m_AsmInfo_tree.GetRootItem(),p_asmfeatlist);//包括装配体、子装配体、零件以及装配特征

    m_AsmInfo_tree.Expand(hroot,TVE_EXPAND);
    return TRUE;
    }

    /************************************************************************/
    /* 把模型下面的元件添加到树节点下面(这里面用到了树控件) */
    /************************************************************************/
    void CDlg_Manager_AsmInfo::ShowModelTree(ProSolid solid,CTreeCtrl & m_Tree
    ,HTREEITEM hItem,CArray<ProFeature,ProFeature> & p_treeitem)
    {
    ProError status;
    CString csName;
    ProName wName;
    HTREEITEM ChildItem, AfItem;
    ProMdlType type;
    ProFeattype ftype;
    CArray<ProFeature,ProFeature> feat_list;

    status = ProMdlTypeGet(solid, &type);
    if(type == PRO_MDL_PART) //零件,获取该零件下的装配特征添加在子节点上
    {
    status = ProMdlNameGet(solid, wName);

    CArray<CBIT_AsmFeature*,CBIT_AsmFeature*> AsmFeature;
    AsmFeature.RemoveAll();
    CBIT_MemoryFile mfile;
    mfile.GetAsmFeat(wName, type, AsmFeature);
    for (int j = 0; j < AsmFeature.GetCount(); j ++)
    {
    AfItem = m_Tree.InsertItem(AsmFeature.GetAt(j)->m_strAsmFeatName + _T(".AF"), hItem);
    m_Tree.SetItemData(AfItem,p_treeitem.GetCount());
    }
    return();
    }
    //装配体,访问其下面的所有特征(子装配体、零件等),添加子树
    //访问实体模型solid的所有特征
    status=ProSolidFeatVisit(solid,(ProFeatureVisitAction)Manager_FeatureAsmVisitAcFn
    ,NULL,(CArray<ProFeature,ProFeature>*)&feat_list);
    int num=(int)feat_list.GetCount();

    //循环获得每个特征的类型,并判断类型是否为元件
    for (int i = 0; i < num; i ++)
    {
    status = ProFeatureTypeGet (&feat_list[i], &ftype);

    //如果特征的类型为元件,则把元件的文件名添加插入到树节点下面
    if (ftype == PRO_FEAT_COMPONENT)
    {
    ProSolid mdl;
    status=ProAsmcompMdlGet((ProAsmcomp *)(&feat_list[i]), (ProMdl *)&mdl);
    status=ProMdlNameGet(mdl,wName);
    csName=CString(wName);
    status=ProMdlTypeGet(mdl,&type);

    //获得元件的类型(装配件或零件),并在名称后面添加文件扩展符
    if (type == PRO_MDL_ASSEMBLY) csName = csName + _T(".ASM");
    if (type ==PRO_MDL_PART) csName = csName + _T(".PRT");

    //////把元件添加到树节点下面
    ChildItem = m_Tree.InsertItem(csName, hItem);
    p_treeitem.Add(feat_list[i]);
    m_Tree.SetItemData(ChildItem,p_treeitem.GetCount());

    //递归展开子树
    ShowModelTree(mdl,m_Tree,ChildItem,p_treeitem);
    }
    }
    }

    【Python之机器学习(NumPy)】

  • 相关阅读:
    Java中抽象类和接口的区别(abstract class VS interface)
    ECUST_Algorithm_2019_4
    ECUST_Algorithm_2019_3
    杂题
    ECUST_Algorithm_2019_2
    Magolor的数据结构作业
    ECUST_Algorithm_2019_1
    atcoder 泛做
    2018中国大学生程序设计竞赛
    UVA
  • 原文地址:https://www.cnblogs.com/michael2016/p/5241518.html
Copyright © 2011-2022 走看看