ObjectARX

Reply
New Member
dr.gattaca
Posts: 1
Registered: ‎08-29-2012
Message 1 of 2 (188 Views)

looking for an example of using: AcDb3dSolid::createRevolvedSolid

188 Views, 1 Replies
08-29-2012 04:54 PM

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

ADN Support Specialist
Balaji_Ram
Posts: 663
Registered: ‎03-21-2011
Message 2 of 2 (162 Views)

Re: looking for an example of using: AcDb3dSolid::createRevolvedSolid

09-03-2012 08:59 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community