|
[code] /*Util Method To create Entity*/
AcDbEntity* createEntity(int index)
{
AcDbEntity* entity = NULL;
AcGePoint3d startPt(0,0,0);
AcGePoint3d endPt(20,20,0);
switch(index)
{
/*Profile 1*/
case 1:
{
AcDbCircle* c = new AcDbCircle(AcGePoint3d(0.0,0.0,0.0),AcGeVector3d(0.0,0.0,1.0),0.5);
entity = (AcDbEntity*)c;
break;
}
/*Profile 2*/
case 2:
{
AcDbPolyline *pRect = new AcDbPolyline();
AcGePoint2d vertex1(startPt.x,startPt.y);
AcGePoint2d vertex2(endPt.x,startPt.y);
AcGePoint2d vertex3(endPt.x,endPt.y);
AcGePoint2d vertex4(startPt.x,endPt.y);
pRect->addVertexAt(0,vertex1);
pRect->addVertexAt(1,vertex2);
pRect->addVertexAt(2,vertex3);
pRect->addVertexAt(3,vertex4);
pRect->setClosed(Adesk::kTrue);
entity = (AcDbEntity*)pRect;
break;
}
/*Path for Path ARRAY*/
case 3:
{
AcDbLine *line = new AcDbLine(startPt,endPt);
entity = (AcDbEntity*)line;
break;
}
default:
break;
}
return entity;
}
void createArray()
{
CString prompt = _T("Select Type of array :");
acedInitGet(0, _T("Curve Rect Polar"));
ACHAR kword[255]; ACHAR pr[255];
wsprintf(pr, ACRX_T("%s Curve/Rect/<Polar>"), prompt);
if(acedGetKword(pr, kword) == RTNORM)
{
if(!_tcscmp(kword,L"Curve"))
{
acutPrintf(_T("Curve\n"));
createPathArray();
}
else if(!_tcscmp(kword,L"Rect"))
{
acutPrintf(_T("Rect\n"));
createRectArray();
}
else if(!_tcscmp(kword,L"Polar"))
{
acutPrintf(_T("Polar\n"));
createPolarArray();
}
else
{
acutPrintf(_T("InvalidInput"));
}
}
}
//**************************************************************
extern "C"
AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void *pkt)
//**************************************************************
{
switch(msg)
{
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(pkt);
acrxDynamicLinker->registerAppMDIAware(pkt);
acedRegCmds->addCommand(_T("TestCmd"),_T("ARY"),_T("ARY"), ACRX_CMD_TRANSPARENT,createArray);
break;
case AcRx::kUnloadAppMsg:
acedRegCmds->removeGroup(_T("TestCmd"));
break;
default:
break;
}
return AcRx::kRetOK;
}[/code] |
|