ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

looking for an example of using: AcDb3dSolid::createRevolvedSolid

1 REPLY 1
Reply
Message 1 of 2
dr.gattaca
581 Views, 1 Reply

looking for an example of using: AcDb3dSolid::createRevolvedSolid

Hi read for a long time on the help files. Just don't get a clue how to start, by any chance somebody got a sample code of it. Much appreciate.

 

Gat

1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: dr.gattaca

Hi Gat,

 

Here is a simplest example using createRevolvedSolid.

It creates a cylinder by revolving a line about the Z axis. Hope this provides you a starting point.

 

AcGePoint3d sp(10.0, 0.0, 0.0);
AcGePoint3d ep(10.0, 0.0, 10.0);
AcDbLine *pRevEnt = new AcDbLine(sp, ep);

Acad::ErrorStatus es;
AcDb3dSolid* pShapeSld = new AcDb3dSolid ();
AcDbRevolveOptions revolveOptions;

revolveOptions.setDraftAngle(0.0);

if((es = pShapeSld->createRevolvedSolid(
	pRevEnt, 
	AcGePoint3d::kOrigin, 
	AcGeVector3d::kZAxis, 
	6.28318530718, 
	0.0, 
	revolveOptions
	)) != Acad::eOk)
{
	acutPrintf(L"\nSolid creation failed...\n");
	delete pShapeSld;
	return;
}
pShapeSld->setColorIndex(2); 

AcDbObjectId id;
postToDb(pShapeSld, id);


Here is the postToDb method :

static Acad::ErrorStatus postToDb(AcDbEntity* ent, AcDbObjectId& objId)
{
	Acad::ErrorStatus      es;
	AcDbBlockTable*        pBlockTable;
	AcDbBlockTableRecord*  pSpaceRecord;

	if ((es = acdbHostApplicationServices()->workingDatabase()->
		   getSymbolTable(pBlockTable, AcDb::kForRead))
		   != Acad::eOk) {
		return es;
	}

	if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE, 
								 pSpaceRecord,
								 AcDb::kForWrite)) != Acad::eOk) {
		return es;
	}

	if ((es = pBlockTable->close()) != Acad::eOk) {
		return es;
	}

	if ((es = pSpaceRecord->appendAcDbEntity(objId, ent)) != Acad::eOk) {
		return es;
	}

	if ((es = pSpaceRecord->close()) != Acad::eOk) {
		return es;
	}

	return ent->close();
}

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost