明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3300|回复: 19

11.2好郁闷啊!为何不能在mfc例程modeless中的对话框的控件响应函数中新建直线或公

  [复制链接]
发表于 2003-11-2 11:40:00 | 显示全部楼层 |阅读模式
11.2好郁闷啊!为何不能在mfc例程modeless中的对话框的控件响应函数中新建直线或公差操作?[br]想通过对话框实现用户选择公差相关数据,提交完后,我在图纸标出
//程序如下所示:
void CSampDialog::OnCancel()
{
//修改一:
CDialog::OnOK();
        runIt();


//以下为新建响应函数部分       
}
AcDbObjectId createFcf()
{

//AcGePoint3d center(90, 300, 0.0);
//急问:为何添加AcGePoint3d center(90, 300, 0.0);和pLine->setLocation(center);
//设置公差插入的位置,狂报错啊!
//note:1.错误见最后部分
//2.放到ents例子中画公差一点问题也没有
//3.放到mfc的contextmenu例子中也报同样的错啊,注释掉那两句后,没有错误啊!
AcDbFcf *pLine = new AcDbFcf();
pLine->setText("{\\Fgdt;a}%%v0.1%%v%%v%%v%%v");

//pLine->setLocation(center);

   AcDbBlockTable *pBlockTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pBlockTable, AcDb::kForRead);

    AcDbBlockTableRecord *pBlockTableRecord;
    pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
        AcDb::kForWrite);
    pBlockTable->close();

    AcDbObjectId FcfId;
    pBlockTableRecord->appendAcDbEntity(FcfId, pLine);

    pBlockTableRecord->close();
    pLine->close();

    return FcfId;       

}
void createNewLayer()
{
    AcDbLayerTable *pLayerTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pLayerTable, AcDb::kForWrite);

    AcDbLayerTableRecord *pLayerTableRecord =
        new AcDbLayerTableRecord;
    pLayerTableRecord->setName("ASDK_MYLAYER");

        // Defaults are used for other properties of
        // the layer if they are not otherwise specified.

        pLayerTable->add(pLayerTableRecord);
    pLayerTable->close();
    pLayerTableRecord->close();
}
void createGroup(AcDbObjectIdArray& objIds, char* pGroupName)
{
    AcDbGroup *pGroup = new AcDbGroup(pGroupName);

    for (int i = 0; i < objIds.length(); i++)
        {
        pGroup->append(objIds);
    }

    // Put the group in the group dictionary which resides
    // in the named object dictionary.
    //
    AcDbDictionary *pGroupDict;
    acdbHostApplicationServices()->workingDatabase()
        ->getGroupDictionary(pGroupDict, AcDb::kForWrite);

    AcDbObjectId pGroupId;
    pGroupDict->setAt(pGroupName, pGroup, pGroupId);
    pGroupDict->close();
    pGroup->close();
}


void runIt()
{
         createNewLayer();

    AcDbObjectIdArray idArr;

        idArr.append(createFcf());
   
    createGroup(idArr, "ASDK_TEST_GROUP");
}
//Linking...
SampDialog.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall AcGePoint3d::AcGePoint3d(double,double,double)" (__imp_??0AcGePoint3d@@QAE@NNN@Z)
.\modeless.arx : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
 楼主| 发表于 2003-11-2 12:42:00 | 显示全部楼层
lilin,goldlenshin...............,都能出书编大程序的人了,快帮我解答啊!
 楼主| 发表于 2003-11-2 19:15:00 | 显示全部楼层
AcGePoint3d::AcGePoint3d(double,double,double)" (__imp_??0AcGePoint3d@@QAE@NNN@Z)
是类型定义错误吗?怎么办啦?
 楼主| 发表于 2003-11-2 21:01:00 | 显示全部楼层
AcGePoint3d::AcGePoint3d(double,double,double)" (__imp_??0AcGePoint3d@@QAE@NNN@Z)
是类型定义错误吗?怎么办啦?
发表于 2003-11-4 20:19:00 | 显示全部楼层
也应该是没有加入它LIB文件吧!试一试,应该是那样的
 楼主| 发表于 2003-11-5 20:57:00 | 显示全部楼层
是的啊!问题已经全部搞定了,哈哈哈
lilin,你好可爱啊!
发表于 2003-11-6 10:54:00 | 显示全部楼层
呵呵,对了。YY,你对DBX是不是很熟悉呀!我现在正在读关于DBX的书呢?不过是英文板的,特别难理解,
 楼主| 发表于 2003-11-6 19:37:00 | 显示全部楼层
ObjectDBX allows you to write separate executables for the user-interface (UI) and database (DB) portions of your application.
是做ui还是db呢?我先学的vc,对纯ado数据库熟一点
我正打算学com组件
 楼主| 发表于 2003-11-6 19:44:00 | 显示全部楼层
我将程序做成可复用组件,然后搭积木形式组装一个形位公差应用系统,底层是按照GPS规范做的数据库。不知你要做什么呢?
什么时候把我的程序传给你?帮我看看,怎么样?
 楼主| 发表于 2003-11-7 18:44:00 | 显示全部楼层
lilin,你最近上哪去了?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 20:29 , Processed in 0.166663 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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