void
ArxDbgUiTdcSysReactors::attachTransactionReactorToAll()
{
    if (m_transReactor) {
		AcDbDatabase* tmpDb;
		AcDbVoidPtrArray dbPtrs;
		ArxDbgUtils::getAllDatabases(dbPtrs);

		AcDbTransactionManager* tmpTrMgr;
		AcDbVoidPtrArray trMgrs;	// keep track of ones we've attached to since some db's share transMgr

        acutPrintf(_T("\nAttaching Transaction Reactor to all active databases..."));

		int len = dbPtrs.length();
		for (int i=0; i<len; i++) {
			tmpDb = static_cast<AcDbDatabase*>(dbPtrs[i]);

			tmpTrMgr = tmpDb->transactionManager();
			if (tmpTrMgr && (trMgrs.contains(tmpTrMgr) == false)) {
				tmpTrMgr->addReactor(m_transReactor);
				trMgrs.append(tmpTrMgr);
			}
			else {
				CString str;
				acutPrintf("\nSkipping duplicate transaction manager for: (%s)", ArxDbgUtils::dbToStr(tmpDb, str));
			}
		}
	}
}
示例#2
0
//----- EXPLODE command
Acad::ErrorStatus OarxEmployee::explode (AcDbVoidPtrArray &entitySet) const {
	//----- Make sure the object is open is read mode
	assertReadEnabled () ;

	AcDbCircle *pCircle =NULL ;
	AcDbText *pText =NULL ;

	try {
		//----- Create the circle
		pCircle =new AcDbCircle (center (), AcGeVector3d (0.0, 0.0, 1.0), 1.0) ;
		if ( pCircle == NULL )
			throw Acad::eOutOfMemory ;
		//----- Create the text
		char buffer [255] ;
		sprintf (buffer, "%d\n%s %s", mID, mFirstName, mLastName) ;
		pText =new AcDbText (center (), buffer, AcDbObjectId::kNull, 0.5, 0.0) ;
		if ( pText == NULL )
			throw Acad::eOutOfMemory ;
		//----- Add the 2 new entities in the array
		entitySet.append (pCircle) ;
		entitySet.append (pText) ;

		return (Acad::eOk) ;

	} catch (const Acad::ErrorStatus es) {
		if ( pCircle != NULL )
			delete pCircle ;
		if ( pText != NULL )
			delete pText ;

		return (es) ;
	}
}
void
ArxDbgUiTdcPersistentReactors::getAttachedEntities(AcDbObjectIdArray& objIds)
{
	AcDbVoidPtrArray dbPtrs;
	ArxDbgUtils::getAllDatabases(dbPtrs);

	AcDbObjectId prId;
	ArxDbgPersistentEntReactor* peReactor;
	Acad::ErrorStatus es;
	AcDbObjectIdArray tmpIds;

	int len = dbPtrs.length();
	for (int i=0; i<len; i++) {
		prId = getPersistentEntReactor(static_cast<AcDbDatabase*>(dbPtrs[i]), false);

		es = acdbOpenObject(peReactor, prId, AcDb::kForRead);
		if (es == Acad::eOk) {
			tmpIds.setLogicalLength(0);	// reusing array for each database

			peReactor->getAttachedToObjs(tmpIds);
			peReactor->close();

			objIds.append(tmpIds);
		}
	}
}
Acad::ErrorStatus PDSphere::subExplode(AcDbVoidPtrArray& entitySet) const
#else
Acad::ErrorStatus PDSphere::explode(AcDbVoidPtrArray& entitySet) const
#endif
{
	assertReadEnabled();

	AcDb3dSolid *pBody;
	pBody = new AcDb3dSolid;
	if(pBody->createSphere(m_dRadius) != Acad::eOk)
	{
		delete pBody;
		return Acad::eNotApplicable;
	}

	AcGeMatrix3d mat;
	mat.setTranslation(m_ptCenter.asVector());

	pBody->transformBy(mat);

	pBody->setPropertiesFrom(this);
	entitySet.append(pBody);

	return Acad::eOk;
}
示例#5
0
Acad::ErrorStatus  AcLine::moveGripPointsAt(const AcDbVoidPtrArray&gripAppData,
										const AcGeVector3d &offset,
                                        const int bitflags)
{
	std::string *pshotGrip = 0;
	AcGePoint3d point;
	
	for(int i=0;i<gripAppData.length(); i++)
	{
		pshotGrip = static_cast<std::string*>(gripAppData[i]);
		if(*pshotGrip == _T("First"))
		{
			msp += offset;
			continue;
		}
		else if(*pshotGrip ==_T("Second"))
		{
			mep += offset;
			continue;
		}
		else if(*pshotGrip == _T("Center"))
		{
			mcp += offset;
			continue;

		}
	}
	return Acad::eOk;
}
void
ArxDbgUiTdcSysReactors::attachDbReactorToAll()
{
    if (m_dbReactor) {
		AcDbDatabase* tmpDb;
		AcDbVoidPtrArray dbPtrs;
		ArxDbgUtils::getAllDatabases(dbPtrs);

        acutPrintf(_T("\nAttaching Database Reactor to all active databases..."));

		int len = dbPtrs.length();
		for (int i=0; i<len; i++) {
			tmpDb = static_cast<AcDbDatabase*>(dbPtrs[i]);
		    tmpDb->addReactor(m_dbReactor);
		}
	}
}
void
ArxDbgUiTdcSysReactors::removeInputReactorFromAll()
{
    if (m_inputReactor) {
		AcApDocument* tmpDoc;
		AcDbVoidPtrArray docPtrs;
		ArxDbgUtils::getAllDocuments(docPtrs);

        acutPrintf(_T("\nRemoving Editor Input Reactor from all documents..."));

		int len = docPtrs.length();
		for (int i=0; i<len; i++) {
			tmpDoc = static_cast<AcApDocument*>(docPtrs[i]);
		    tmpDoc->inputPointManager()->removeInputContextReactor(m_inputReactor);
		}
	}
}
void
ArxDbgUiTdcSysReactors::removeDbReactorFromAll()
{
    if (m_dbReactor) {
		AcDbDatabase* tmpDb;
		AcDbVoidPtrArray dbPtrs;
		ArxDbgUtils::getAllDatabases(dbPtrs);

        acutPrintf(_T("\nRemoving Database Reactor from all active databases..."));

		int len = dbPtrs.length();
		for (int i=0; i<len; i++) {
			tmpDb = static_cast<AcDbDatabase*>(dbPtrs[i]);
		    tmpDb->removeReactor(m_dbReactor);
		}
	}
}
示例#9
0
AcDbObjectId CArxHelper::CreateBlock(const AcDbVoidPtrArray& arrEnt, const CString& strName)
{
	AcDbObjectId blockId = AcDbObjectId::kNull;
	AcDbBlockTableRecord* pBlockTableRecord = new AcDbBlockTableRecord();
	pBlockTableRecord->setName(strName);
	pBlockTableRecord->setOrigin(AcGePoint3d::kOrigin);
	for (int i = 0; i < arrEnt.length(); ++ i)
	{
		AcDbEntity* pEntity = (AcDbEntity*)arrEnt.at(i);
		pBlockTableRecord->appendAcDbEntity(pEntity);
		pEntity->close();
	}

	AcDbBlockTable* pBlockTable = NULL;
	acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForWrite);
	pBlockTable->add(blockId,pBlockTableRecord);
	pBlockTableRecord->close();
	pBlockTable->close();
	return blockId;
}
void
ArxDbgUiTdcSysReactors::removeTransactionReactorFromAll()
{
    if (m_transReactor) {
		AcDbDatabase* tmpDb;
		AcDbVoidPtrArray dbPtrs;
		ArxDbgUtils::getAllDatabases(dbPtrs);

		AcDbTransactionManager* tmpTrMgr;

        acutPrintf(_T("\nRemoving Transaction Reactor from all active databases..."));

		int len = dbPtrs.length();
		for (int i=0; i<len; i++) {
			tmpDb = static_cast<AcDbDatabase*>(dbPtrs[i]);

			tmpTrMgr = tmpDb->transactionManager();
			if (tmpTrMgr)
				tmpTrMgr->removeReactor(m_transReactor);
		}
	}
}
示例#11
0
void
ArxDbgUiTdcCmds::buildCmdGroupMap()
{
    AcEdCommandIterator* iter = acedRegCmds->iterator();
    if (iter == NULL) {
        ASSERT(0);
        return;
    }
        // walk through the command stack and make a map of
		// command group to command.
	AcDbVoidPtrArray* tmpVoidPtrArray;
    for (; !iter->done(); iter->next()) {
		if (m_cmdMap.Lookup(iter->commandGroup(), (void*&)tmpVoidPtrArray)) {
			tmpVoidPtrArray->append(const_cast<AcEdCommand*>(iter->command()));
		}
		else {
			tmpVoidPtrArray = new AcDbVoidPtrArray;
			tmpVoidPtrArray->append(const_cast<AcEdCommand*>(iter->command()));
			m_cmdMap.SetAt(iter->commandGroup(), tmpVoidPtrArray);
		}
	}
    delete iter;
}
示例#12
0
Acad::ErrorStatus
AsdkSmiley::explode(AcDbVoidPtrArray& entities) const
{
    assertReadEnabled();

    AcDbCircle *pCircle = new AcDbCircle( center(), mnormal, radius() );
    entities.append( pCircle );

    // Create eyes
    //
    AcGePoint3dArray eyearray;
    eyes( eyearray );
    for( int i = 0; i < eyearray.length(); i++ ){
        AcDbCircle *pCircle = new AcDbCircle( eyearray.at(i), mnormal, meyesize );
        entities.append( pCircle );
    }

    // Create smile arc
    //
    AcGePoint3d smilecen( mouthCenter() ),
                startpt( mouthLeft() ),
                endpt( mouthRight() );
    AcGeVector3d normvec( 1, 0, 0 ),
                 startvec = startpt - smilecen,
                 endvec = endpt - smilecen;
    double startang = 2 * kPi - startvec.angleTo( normvec ),
           endang = 2 * kPi - endvec.angleTo( normvec );
    AcDbArc *pArc = new AcDbArc( smilecen, mnormal, mouthRadius(), startang, endang );
    entities.append( pArc );

    // Create smile arc chord
    //
    AcDbLine *pLine = new AcDbLine( startpt, endpt );
    entities.append( pLine );

    return Acad::eOk;
}
示例#13
0
BOOL
ArxDbgUiTdcCmds::OnInitDialog() 
{
    ArxDbgUiTdcRxObjectBase::OnInitDialog();

	buildCmdGroupMap();

    POSITION pos;
    CString str;
    AcDbVoidPtrArray* cmds = NULL;
    HTREEITEM treeItem;
	AcEdCommand* tmpCmd;
	bool isFirst = true;

    for (pos = m_cmdMap.GetStartPosition(); pos != NULL;) {
        m_cmdMap.GetNextAssoc(pos, str, (void*&)cmds);
 		treeItem = addCmdTreeItem(str, NULL, TVI_ROOT, true);
		if (treeItem != NULL) {
			int len = cmds->length();
			for (int i=0; i<len; i++) {
				tmpCmd = static_cast<AcEdCommand*>(cmds->at(i));
				addCmdTreeItem(tmpCmd->localName(), tmpCmd, treeItem, true);
			}

			if (isFirst) {
				m_cmdTree.SelectItem(treeItem);		// make first one selected
				isFirst = false;
			}
		}
   }

	buildColumns(m_dataList);
    displayCurrent();

    return TRUE;
}
void
ArxDbgUtils::getAllDocuments(AcDbVoidPtrArray& docPtrs)
{
    AcApDocumentIterator* iter = acDocManager->newAcApDocumentIterator();
    if (iter) {
        AcApDocument* tmpDoc;
        for (; !iter->done(); iter->step()) {
            tmpDoc = iter->document();
            if (tmpDoc) {
                docPtrs.append(tmpDoc);
            }
            else {
                ASSERT(0);
            }
        }
        delete iter;
	}
}
示例#15
0
void BuildLineArray( const AcDbObjectIdArray& objIds, AcDbVoidPtrArray& lines )
{
    AcGePoint3dArray spts, epts;
    GetEdgeSEPts( objIds, spts, epts );

    AcGeDoubleArray widths;
    GetEdgeWidths( objIds, widths );

    // 获取一些属性数据,例如风速等
    // 后续添加
    // ...

    // 创建DoubleLine数组
    int n = spts.length();
    for( int i = 0; i < n; i++ )
    {
        bool isWorkSurface = ArxUtilHelper::IsEqualType( _T( "WorkSurface" ), objIds[i] );
        DoubleLine* pLine = new DoubleLine( spts[i], epts[i], widths[i], isWorkSurface );
        lines.append( ( void* )pLine );
    }
}
示例#16
0
bool isModuleLoaded(const char* str)
{
	AcDbVoidPtrArray* pApps = reinterpret_cast<AcDbVoidPtrArray*>(acrxLoadedApps());
	if (pApps==NULL)
		return false;
	bool bFound = false;
	for (int i=0;i<pApps->length();i++)
	{
		if (stricmp(reinterpret_cast<const char*>(pApps->at(i)),str)==0)
		{
			bFound = true;
			break;
		}
	}
	for (;pApps->length()>0;)
	{
		delete reinterpret_cast<char*>(pApps->at(0));
		pApps->removeAt(0);
	}
	delete pApps;
	return bFound;
}
示例#17
0
//  [9/5/2007 suzhiyong]
Acad::ErrorStatus PDEcone::explodeTo3DSolid(AcDb3dSolid* &p3dSolid) const
{
	assertReadEnabled();

#ifdef _OBJECTARX2004_
	Acad::ErrorStatus es = Acad::eOk;
	int i = 0;
	AcGeVector3d faceVect = getFaceVect();

	AcDbCurve *pCurve = NULL;
	AcDbVoidPtrArray curveSegments;
	double pathLen = m_ptStart.distanceTo(m_ptEnd);

	AcGePoint3d sp, ep;
	double d1, d2;
	if(m_dDiameter1 >= m_dDiameter2)
	{
		sp = m_ptStart;
		ep = m_ptEnd;
		d1 = m_dDiameter1;
		d2 = m_dDiameter2;
	}
	else
	{
		sp = m_ptEnd;
		ep = m_ptStart;
		d1 = m_dDiameter2;
		d2 = m_dDiameter1;
	}

	//extrudeAlongPath函数在由较大region拉成较小region时容易产生自交问题,所以
	//炸开时选择由小的region拉成大的region
	AcDbLine *pLine = new AcDbLine(ep, sp);
    pLine->setPropertiesFrom(this);
	pCurve = pLine;

	if(pCurve != NULL)
	{
		if((es = addToDb(pCurve)) == Acad::eOk)
		{
			AcDbObjectId id;
			id = pCurve->objectId();
			pCurve->close();
			if((es = acdbOpenObject((AcDbCurve*&)pCurve, id, AcDb::kForRead)) != Acad::eOk)
				return Acad::eNotApplicable;
		}
		else
		{
			if(pCurve != NULL)
				delete pCurve;
			return Acad::eNotApplicable;
		}
	}

	AcDbCircle sCir(ep, faceVect, d2 / 2.0);
	curveSegments.append(&sCir);

	AcDbVoidPtrArray regions;
	es = AcDbRegion::createFromCurves(curveSegments, regions);

	if(es == Acad::eOk && !regions.isEmpty())
	{
		AcDb3dSolid *pBody;
		pBody = new AcDb3dSolid;

		////求taper Angle
		//AcGeVector3d vec1 = (m_ptStart-m_ptEnd);//.normal();

		////m_dDiameter1和m_dDiameter2的大小问题
		//AcGeVector3d perpVec = faceVect.perpVector()*((m_dDiameter1/2-m_dDiameter2/2));
		//AcGePoint3d point2(m_ptStart.x+perpVec.x, m_ptStart.y+perpVec.y, m_ptStart.z+perpVec.z);
		//AcGeVector3d vec2 = (point2 - m_ptEnd);//.normal();

		////taperAngle为负时表示放大region,反之为缩小
		//double angle = -1*vec1.angleTo(vec2);
		////angle没有到达最大值时仍然有问题,建议不使用extrudeAlongPath函数

		//taperAngle是指两个圆心连线垂直于圆面时的角度,大于0时表示缩小,小于0时表示放大
		es = pBody->extrudeAlongPath((AcDbRegion*)(regions[0]), pCurve,//angle);
			-1*atan((d1 / 2.0 - d2 / 2.0) / pathLen));

		if(es != Acad::eOk)
		{
			if(pCurve != NULL)
			{
				pCurve->upgradeOpen();
				pCurve->erase();
				pCurve->close();
			}
			delete pBody;
			for(i = 0; i < regions.length(); i++)
				delete (AcRxObject*)regions[i];
			return Acad::eNotApplicable;
		}
		pBody->setPropertiesFrom(this);
		p3dSolid = pBody;
	}
	else
	{
		if(pCurve != NULL)
		{
			pCurve->upgradeOpen();
			pCurve->erase();
			pCurve->close();
		}
		for(i = 0; i < regions.length(); i++)
			delete (AcRxObject*)regions[i];
		return Acad::eNotApplicable;
	}

	if(pCurve != NULL)
	{
		pCurve->upgradeOpen();
		pCurve->erase();
		pCurve->close();
	}
	for(i = 0; i < regions.length(); i++)
		delete (AcRxObject*)regions[i];

	return Acad::eOk;
#else
	return Acad::eNotApplicable;
#endif
}
示例#18
0
static Acad::ErrorStatus 
thickenPoly(AsdkPoly* poly,AcDbEntity*& ent, AcGePoint2d&  savedCenter,AcGePoint2d&   savedStartPoint,
int& savedNumSides,AcGeVector3d&  savedNormal,char*    savedName, double& savedElevation)
{
    Acad::ErrorStatus es = Acad::eOk;
    int i;
    AcDbVoidPtrArray lines;
    AcDbVoidPtrArray regions;
    
    // Explode to a set of lines
    //
    if ((es = poly->explode(lines)) != Acad::eOk) {
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    
    // Create a region from the set of lines.
    //
    if ((es = AcDbRegion::createFromCurves(lines, regions)) != Acad::eOk) {
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    assert(regions.length() == 1);
    AcDbRegion* region = AcDbRegion::cast((AcRxObject*)regions[0]);
    assert(region != NULL);
    
    // Extrude the region to create a solid.
    //
    double height;
    if ((es = poly->getDistAtParam(6.28318530717958647692, height))
        != Acad::eOk)
    {
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    height *= 0.25;
    
    AcDb3dSolid* solid = new AcDb3dSolid;
    assert(solid != NULL);
    if ((es = solid->extrude(region, height, 0.0)) != Acad::eOk) {
        delete solid;
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    
    // Save up the data to flatten the solid.
    //
    savedCenter     = poly->center();
    savedStartPoint = poly->startPoint();
    savedNumSides   = poly->numSides();
    savedNormal     = poly->normal();
    savedElevation  = poly->elevation();
    // Copy the poly name
    //
    strcpy(savedName, poly->name());
    
    // Now we have a solid. Change the entity to be this solid
    
    if ((es = solid->setPropertiesFrom(poly)) != Acad::eOk) {
        delete solid;
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    ent = poly;
    if ((es = ent->upgradeOpen()) != Acad::eOk) {
        delete solid;
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    es = replaceEntity(ent, solid);
    if ((es != Acad::eOk) && (es != Acad::eObjectToBeDeleted)) {
        ent->downgradeOpen();
        delete solid; 
        for (i = 0; i < lines.length(); i++) {
            delete (AcRxObject*)lines[i];
        }
        for (i = 0; i < regions.length(); i++) {
            delete (AcRxObject*)regions[i];
        }
        return es;
    }
    es = ent->downgradeOpen();
    
    for (i = 0; i < lines.length(); i++) {
        delete (AcRxObject*)lines[i];
    }
    for (i = 0; i < regions.length(); i++) {
        delete (AcRxObject*)regions[i];
    }
    return es;
}
示例#19
0
Acad::ErrorStatus
AcRectangle::moveGripPointsAt(const AcDbVoidPtrArray& appData,
                              const AcGeVector3d& offset,
                              const int bitflags)
{
    assertWriteEnabled();
	if (!appData.length())
		return Acad::eInvalidInput;

    AcGePoint3d pt1, pt2;
    AcGeVector3d diaVec;

    AppData *pAppData = (AppData*)appData[0];
    int gripID = pAppData->index();
    AcGeVector3d vertDir = mNormal.crossProduct(mHorizDir);
	
    switch(gripID) {
    case 0:
        mCenter += offset;
        break;

    case 1:
        pt1 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt2 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;

    case 2:
        pt1 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt2 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;

    case 3:
        pt1 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt2 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;
	
    case 4:
        pt1 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt2 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;
	}

    // Update dynamic dimensions
    //
    AcDbDimDataPtrArray *pDimDataArr = NULL;
    if (pAppData)
        pDimDataArr = pAppData->dimData();

    updateDimensions(pDimDataArr);

    return Acad::eOk;

}
示例#20
0
Acad::ErrorStatus PDEcone::explodeToSurface(AcDbVoidPtrArray& entitySet) const
{
    assertReadEnabled();

    Acad::ErrorStatus es = Acad::eOk;
    int i;

    AcGePoint3dArray pArray;
    AcGeIntArray stdIdx;
    int actPrecision;
    getVertices(m_dDividPrecision, pArray, stdIdx, actPrecision);
    int actPrecision__1 = actPrecision + 1;
    int actPrecision___2__1 = actPrecision * 2 + 1;

    AcGeVector3d faceVect = getFaceVect();

    AcDbVoidPtrArray curSeg, resRegion;
    AcDbCircle *pCir = NULL;
    AcGePoint3d  ucs_org = acdbCurDwg()->ucsorg();
    AcGeVector3d ucs_x = acdbCurDwg()->ucsxdir();
    AcGeVector3d ucs_y = acdbCurDwg()->ucsydir();
    AcGeVector3d ucs_z = ucs_x.crossProduct(ucs_y);
    AcGeMatrix3d ucs_mat;

    ucs_mat.setToWorldToPlane(-faceVect);
//#ifdef _OBJECTARX14_
//    acdbSetCurrentUCS(ucs_mat);
//#else
//    acedSetCurrentUCS(ucs_mat);
//#endif
    pCir = new AcDbCircle(m_ptStart, -faceVect, m_dDiameter1 / 2.0);
    curSeg.append(pCir);
    es = AcDbRegion::createFromCurves(curSeg, resRegion);
    if(es != Acad::eOk)
    {
        for(i = 0; i < resRegion.length(); ++i)
            delete (AcRxObject*)resRegion[i];
    }
    else
    {
        for(i = 0; i < resRegion.length(); ++i)
            ((AcDbEntity *)resRegion[i])->setPropertiesFrom(this);
        entitySet.append(resRegion);
    }
    for(i = 0; i < curSeg.length(); ++i)
        delete (AcRxObject*)curSeg[i];
    
    curSeg.setLogicalLength(0);
    resRegion.setLogicalLength(0);

    ucs_mat.setToWorldToPlane(faceVect);
//#ifdef _OBJECTARX14_
//    acdbSetCurrentUCS(ucs_mat);
//#else
//    acedSetCurrentUCS(ucs_mat);
//#endif
    pCir = new AcDbCircle(m_ptEnd, faceVect, m_dDiameter2 / 2.0);
    curSeg.append(pCir);
    es = AcDbRegion::createFromCurves(curSeg, resRegion);
    if(es != Acad::eOk)
    {
        for(i = 0; i < resRegion.length(); ++i)
            delete (AcRxObject*)resRegion[i];
    }
    else
    {
        for(i = 0; i < resRegion.length(); ++i)
            ((AcDbEntity *)resRegion[i])->setPropertiesFrom(this);
        entitySet.append(resRegion);
    }
    for(i = 0; i < curSeg.length(); ++i)
        delete (AcRxObject*)curSeg[i];

    ucs_mat.setCoordSystem(ucs_org, ucs_x, ucs_y, ucs_z);
//#ifdef _OBJECTARX14_
//    acdbSetCurrentUCS(ucs_mat);
//#else
//    acedSetCurrentUCS(ucs_mat);
//#endif

    AcDbPolygonMesh *pMesh;
    pMesh = new AcDbPolygonMesh(AcDb::kSimpleMesh, 2, actPrecision + 1,
                                pArray, Adesk::kFalse, Adesk::kFalse);
    pMesh->setPropertiesFrom(this);
    entitySet.append(pMesh);

    return Acad::eOk;
}