TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- #define AOK(es) if(es != Acad::eOk) throw es;
- void createHatch(void)
- {
- AcDbObjectId objId;
- AcDbEntity* pEnt;
- ads采用name ent;
- ads采用point point;
- if (RTNORM != acedEntSel("SELECT AN ENTITY TO BE HATCHED: ", ent,
- point))
- return;
- assert(objId.setFromOldId(ent[0]));
- AOK( acdbOpenObject(pEnt,objId,AcDb::kForRead) );
- AcDbHatch *pHatch = new AcDbHatch;
- assert(pHatch);
- try
- {
- AcDbBlockTableRecordPointer pBtr(ACDB采用MODEL采用SPACE,
- curDoc()->database(), AcDb::kForWrite);
- AOK(pBtr.openStatus());
- AOK(pHatch->setPatternAngle(0));
- AOK(pHatch->setPatternScale(10));
- AOK(pHatch->setAssociative(Adesk::kFalse));
- AOK(pHatch->setPattern(AcDbHatch::kPreDefined, "ANSI32"));
- // append loop to hatch
- AcDbObjectIdArray dbObjIds;
- int objNum = dbObjIds.append(pEnt->objectId());
- acutPrintf("\nOBJ number is %d.", objNum);
- AOK(pHatch->appendLoop(AcDbHatch::kExternal, dbObjIds));
- AOK(pHatch->setLayer(pEnt->layer()));
- AOK(pHatch->setColorIndex(256)); //bylayer
- AOK(pHatch->setHatchStyle(AcDbHatch::kNormal));
- AOK(pHatch->evaluateHatch());
- AOK(pBtr->appendAcDbEntity(pHatch));
- AOK(pHatch->close());
- }
- catch (const Acad::ErrorStatus es)
- {
- acutPrintf("Error: %s", acadErrorStatusText(es));
- delete pHatch;
- }
- }
复制代码 |
|