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

Draw a block from external reference inside a custom entity's subWorldDraw function.

1 REPLY 1
SOLVED
Reply
Message 1 of 2
rudolfkorcsmaros
351 Views, 1 Reply

Draw a block from external reference inside a custom entity's subWorldDraw function.

Hi there!

 

I used c++ to create a custom entity. Now, I have a block inside an external dwg file. How can I draw that block inside the custom entity's subWorldDraw function, as part of the entity.

1 REPLY 1
Message 2 of 2
tbrammer
in reply to: rudolfkorcsmaros

This is how you can draw the entities in the block with the block transformation of the BREF:

void DrawBref(AcGiWorldDraw *mode, AcDbBlockReference* bref)
{
	AcDbBlockTableRecord *block;
	Acad::ErrorStatus es;
	if ((es = acdbOpenObject(block, bref->blockTableRecord(), AcDb::kForRead)) == Acad::eOk)
	{
		AcDbBlockTableRecordIterator* blkIter = 0;
		if (block->newIterator(blkIter) == Acad::eOk) {
			AcDbEntity* ent;
			mode->geometry().pushModelTransform(bref->blockTransform());
			for (; !blkIter->done(); blkIter->step()) {
				if (blkIter->getEntity(ent, AcDb::kForRead) == Acad::eOk) {
					mode->geometry().draw(ent);
					ent->close();
				}
			}
			mode->geometry().popModelTransform();
			delete blkIter;
		}
		block->close();
	}
}

Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report