- UID
- 395050
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2006-2-16
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
程序编译通过,可CAD执行时出现错误,
请朋友门一起来看看,帮助一下
void Myfl()
{
ads_name ents;
long entNums;
struct resbuf *rb1;
rb1 = acutBuildList(RTDXF0,"pline",8,"0",6,"continuous",RTNONE);
acedSSGet("X",NULL,NULL,rb1,ents);
acutRelRb(rb1); //don't forget
acedSSLength(ents,&entNums);
AcDbObjectIdArray dbObjIds;
if (entNums != 0)
{
for (long a = 0; a < entNums ; a ++)
{
AcDbObjectId objId;
ads_name ent;
AcDbHatch* pHatch=new AcDbHatch();
acedSSName(ents,a,ent);
acdbGetObjectId(objId, ent);
dbObjIds.append(objId);
}
}
acedSSFree(ents);
acutRelRb(rb1);
AcDbHatch* pHatch = new AcDbHatch();
AcDbObjectId hatchId;
// Set hatch plane
//
AcGeVector3d normal(0.0, 0.0, 1.0);
pHatch->setNormal(normal);
pHatch->setElevation(0.0);
// Set hatch pattern to ANSI31 predefined type
//
pHatch->setPattern(AcDbHatch::kPreDefined, "ANSI31");
// Set Associativity
//
pHatch->setAssociative(Adesk::kTrue);
// Append an external rectangular loop to hatch boundary
//
pHatch->appendLoop(AcDbHatch::kExternal, dbObjIds);
// Append an internal loop (circle) to hatch boundary
//
pHatch->appendLoop(AcDbHatch::kDefault, dbObjIds);
// Elaborate hatch lines
//
pHatch->evaluateHatch();
// Get all associative source boundary object Ids for later use.
//
dbObjIds.setLogicalLength(0);
pHatch->getAssocObjIds(dbObjIds);
// Post hatch entity to database
//
//pHatch->postToDb(pHatch, hatchId);
long i=0;
AcDbBlockTable * pDbBT;
AcDbBlockTableRecord * pDbBTR;
AcDbDatabase * pDbDatab = acdbHostApplicationServices()->workingDatabase();
pDbDatab->getSymbolTable(pDbBT, AcDb::kForRead);
pDbBT->getAt(ACDB_MODEL_SPACE, pDbBTR, AcDb::kForWrite);
// Attach hatchId to all source boundary objects for notification.
//
AcDbEntity *pEnt;
int numObjs = dbObjIds.length();
Acad::ErrorStatus es;
for (i = 0; i < numObjs; i++) {
es = acdbOpenAcDbEntity(pEnt, dbObjIds, AcDb::kForWrite);
if (es == Acad::eOk){
pDbBTR->appendAcDbEntity(dbObjIds, pHatch);
}
}
pDbBT->close();
pDbBTR->close();
pHatch->close();
} |
|