- 积分
- 2670
- 明经币
- 个
- 注册时间
- 2003-11-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
- CMultiCircleJigEntity::CMultiCircleJigEntity(const AcGePoint3d & centerPoint, const unsigned int &iNum)
- {
- AcDbCircle *pCirc;
- for (int i = 0; i < iNum; i++)
- {
- pCirc = new AcDbCircle(centerPoint, AcGeVector3d::kZAxis, 1.0);
- m_CircArr.append(pCirc);
- }
- }
- CMultiCircleJigEntity::~CMultiCircleJigEntity()
- {
- for (int i = 0; i < m_CircArr.length(); i++)
- {
- delete m_CircArr[i];
- }
- }
- Adesk::Boolean CMultiCircleJigEntity::worldDraw(AcGiWorldDraw *mode)
- {
- for (int i = 0; i < m_CircArr.length(); i++)
- {
- mode ->geometry().draw(m_CircArr[i]);
- }
- return (AcDbEntity::worldDraw (mode)) ;
- }
- void CMultiCircleJigEntity::setRadius(double dRadius)
- {
- if (m_CircArr.length() <= 0)
- return;
- double dCurRadius = dRadius;
- double dRadiusStep = dRadius / m_CircArr.length();
- for (int i = 0; i < m_CircArr.length(); i++)
- {
- m_CircArr[i] ->setRadius(dCurRadius);
- dCurRadius -= dRadiusStep;
- }
- }
- void CMultiCircleJigEntity::appendToCurrentSpace()
- {
- AcDbDatabase * pDb = acdbCurDwg();
- AcDbBlockTable *pBlockTable;
- pDb ->getBlockTable(pBlockTable, AcDb::kForWrite);
- AcDbBlockTableRecord *pBlkRec;
- pBlkRec = new AcDbBlockTableRecord();
- CString blkName = _T("ss");
-
- pBlkRec->setName(blkName);
- AcDbObjectId blkDefId;
- pBlockTable->add(blkDefId, pBlkRec);
-
- ////////////////////////////////////////////////////////////////////////////
- if (pDb ->tilemode())
- {
- pBlockTable ->getAt(ACDB_MODEL_SPACE, pBlkRec, AcDb::kForWrite);
- }
- else
- {
- pBlockTable ->getAt(ACDB_PAPER_SPACE, pBlkRec, AcDb::kForWrite);
- }
- pBlockTable ->close();
- for (int i = 0; i < m_CircArr.length(); i++)
- {
- AcDbCircle *& pCirc = m_CircArr.at(i);
- AcDbObjectId entId;
- if (Acad::eOk == pBlkRec ->appendAcDbEntity(entId,pCirc))
- {
- pCirc ->setDatabaseDefaults();
- pCirc ->close();
- }
- else
- {
- delete pCirc;
- }
- }
- pBlkRec ->close();
- m_CircArr.removeAll();
- }
复制代码 帮忙指点下,为什么不能生成块?
|
|