- UID
- 236231
- 积分
- 86
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-4-1
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
bool CBlueprintDrawing::CreateBlueprint(long lBluePrintTemplateID, int iPageNo)
{
Acad::ErrorStatus es;
AcDbDatabase *pDb;
CString m_BlueprintFileFullName;
CString t_BlueprintTemplateFileName;
pDb = new AcDbDatabase;
//获取模板文件名
es = pDb->readDwgFile( t_BlueprintTemplateFileName);
if( es != Acad::eOk )
{
acutPrintf("\n没有发现 %c 文件!\n", t_BlueprintTemplateFileName);
delete pDb;
return false;
}
AcDbDatabase *pOldDb = acdbHostApplicationServices()->workingDatabase();
acdbHostApplicationServices()->setWorkingDatabase(pDb);
AcDbBlockTable *pBlockTable;
pDb->getSymbolTable(pBlockTable, AcDb::kForRead);
//acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
//---- 绘制图形
CBlueprintDrawing::CreateTableGroup( pBlockTableRecord );
//---- 绘制图纸框架
//?????????????? 选择集出现问题
//如果pOldDb中在选择区域中有实体,就可以;反之不行。
//希望pDb中在选择区域中有实体,就可以;反之不行。
//pDb已经是当前数据库为什么还关联pOldDb[/COLOR]
CBlueprintDrawing::CreateFrameLine( pBlockTableRecord );
//---- 关闭块表
pBlockTableRecord->close();
//切换回原工作表
acdbHostApplicationServices()->setWorkingDatabase(pOldDb);
//保存图纸
pDb->saveAs(m_BlueprintFileFullName);
delete pDb;
}
bool CBlueprintDrawing::CreateFrameLine(AcDbBlockTableRecord *pBlockTableRecord)
{
int stat;
long Number;
ads_name SSName;
ads_point t_ptW0, t_ptW1;
AcGePoint3d ptW0(0, 0, 0), ptW1(0, 297, 0);
Number = 0;
t_ptW0[X] = 210.0;
t_ptW0[Y] = 0.0;
t_ptW0[Z] = 0.0;
t_ptW1[X] = 420.0;
t_ptW1[Y] = 297.0;
t_ptW1[Z] = 0.0;
//建一个交叉窗口选择集
stat = acedSSGet("C", t_ptW0, t_ptW1, NULL, SSName);
if ( stat != RTNORM )
{
acedAlert("创建交叉选择集不成功!");
}
else
{
acedSSLength(SSName, &Number);
acedAlert("创建交叉选择集成功!");
while ( Number != 0 )
{
ptW0.x = t_ptW0[X];
ptW1.x = t_ptW1[X];
t_ptW0[X] += 210.0;
t_ptW1[X] += 210.0;
Number = 0;
acedSSFree(SSName);
acedSSGet("C", t_ptW0, t_ptW1, NULL, SSName);
acedSSLength(SSName, &Number);
}
}
//-- 绘制外框线
AcGePoint3d pt0(0, 0, 0), pt1(0, 297, 0), pt2(0, 0, 0), pt3(0, 0, 0);
pt2.x = ptW1.x;
pt2.y = ptW1.y;
pt3.x = ptW1.x;
pt3.y = ptW0.y;
CreateLine(pBlockTableRecord, pt0, pt1);
CreateLine(pBlockTableRecord, pt1, pt2);
CreateLine(pBlockTableRecord, pt2, pt3);
CreateLine(pBlockTableRecord, pt3, pt0);
return true;
} |
|