- 积分
- 1423
- 明经币
- 个
- 注册时间
- 2003-8-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
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. |
|