//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CTestIntersect2013App : public AcRxArxApp {
public:
CTestIntersect2013App () : AcRxArxApp () {}
virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kInitAppMsg (pkt) ;
return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kUnloadAppMsg (pkt) ;
return (retCode) ;
}
virtual void RegisterServerComponents () {}
// - TestIntersect2013.TestInt command (do not rename)
static void TestIntersect2013TestInt(void)
{
F4();
}
static void F4()
{
int es1, es2;
ads_name ent1, ent2;
ads_point pt1, pt2;
AcDbObjectId entId1, entId2;
AcGePoint3dArray points;
if (acedEntSel(L"\nУкажите объект 1: ", ent1, pt1) != RTNORM)
return;
if (acdbGetObjectId(entId1, ent1) != Acad::eOk)
return;
AcDbEntityPointer pEnt1(entId1, AcDb::kForRead);
if (pEnt1.openStatus() != Acad::eOk)
return;
if (acedEntSel(L"\nУкажите объект 2: ", ent2, pt2) != RTNORM)
return;
if (acdbGetObjectId(entId2, ent2) != Acad::eOk)
return;
AcDbEntityPointer pEnt2(entId2, AcDb::kForRead);
if (pEnt2.openStatus() != Acad::eOk)
return;
if (pEnt1->intersectWith(pEnt2, AcDb::kOnBothOperands, points) != Acad::eOk || (points.length() == 0))
{
acutPrintf(L"\nОбъекты не пересекаются. ");
return;
}
acutPrintf(L"\nТочки пересечения:");
for (int i = 0; i < points.length(); i++)
acutPrintf(L"\n %d: %.6f %.6f %.6f", i + 1, points[i].x, points[i].y, points[i].z);
}
} ;
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CTestIntersect2013App)
ACED_ARXCOMMAND_ENTRY_AUTO(CTestIntersect2013App, TestIntersect2013, TestInt, TestInt, ACRX_CMD_TRANSPARENT, NULL)