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

[ACAD 2013] Zoom on object

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
gatti.massimo
1323 Views, 4 Replies

[ACAD 2013] Zoom on object

Hi,

I need to zoom on an acdbBlockReference object.

 

I get the lowerleft and the upperright point for the zoom..

 

But how can I zoom on that area with the zoom command?

 

Thanks to everybody for your help!

 

This is my code

 

//zoom on object
			AcDbHandle			pObjHandle;
			AcDbObjectId		ObjId;
			AcDbObject		*	pObj;
			Acad::ErrorStatus	Err;

			pObjHandle = AcDbHandle(ActualNode->_ObjectHandleLow,ActualNode->_ObjectHandleHigh);
			acdbHostApplicationServices()->workingDatabase()->getAcDbObjectId(ObjId , false, pObjHandle);

			//recupero i dati del pnodedetails già presente
			if (acdbOpenAcDbObject(pObj, ObjId, AcDb::kForRead) != Acad::eOk)
			{
				acutPrintf (_T("\nzoom - acdbOpenAcDbEntity error!"));
				//return;
			}


			AcDbBlockReference * pBlockRef = AcDbBlockReference::cast(pObj);

			AcDbExtents block_extents;

			pBlockRef->getGeomExtents(block_extents);

			AcGePoint3d plLowerLeft, ptUpperRight; //-> it's your object extends coords

			plLowerLeft = block_extents.minPoint();
			ptUpperRight = block_extents.maxPoint();

 

4 REPLIES 4
Message 2 of 5
oliver253m
in reply to: gatti.massimo
Message 3 of 5
owenwengerd
in reply to: gatti.massimo

Object extents are in World coordinates, but you need them in display coordinates for zooming. Just convert your handle to an ads_name (using acdbHandEnt), then use acedCommand to call the _ZOOM coomand's _Object option and provide the entity to zoom to.

--
Owen Wengerd
ManuSoft
Message 4 of 5
gatti.massimo
in reply to: oliver253m

Perfect!

It works!

 

Thank you for your help!

Message 5 of 5
minhasp
in reply to: gatti.massimo

   m_ext is ACdbExtern of object;

 

=>>>>>>

    CString minPtstr;
    CString maxPtStr;

    minPtstr.Format(L"%.3f,%.3f",m_ext.minPoint().x,m_ext.minPoint().y);
    maxPtStr.Format(L"%.3f,%.3f",m_ext.maxPoint().x,m_ext.maxPoint().y);


    acedCommand(RTSTR,L"_ZOOM",RTSTR,L"_W",RTSTR,minPtstr,RTSTR,maxPtStr,RTNONE);

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

Post to forums  

Autodesk Design & Make Report

”Boost