|
[code]static void LCTSoftpointertest ()
{
AcDbObjectId eId;
//AcDbCurve * pCurve;//вариант 1
AcDbObjectPointer<AcDbCurve> pCurve;//вариант 2
ads_name ent;
AcGePoint3d ptFrom, ptTo;
ACHAR mode[133];
bool res = true;
while (res)
{
acedInitGet(RSG_NONULL,NULL);
if(acedEntSel(_T("\nУкажите кривую: "),ent,asDblArray(ptFrom))!=RTNORM) return;
AcGeMatrix3d matWcs;
matWcs.setCoordSystem(AcGePoint3d(0.0,0.0,0.0),AcGeVector3d::kXAxis,AcGeVector3d::kYAxis,AcGeVector3d::kZAxis);
acedSetCurrentUCS(matWcs);//WCS
if(acdbGetObjectId(eId, ent)!= Acad::eOk) return;
//->вариант 1
//if (acdbOpenObject(pCurve,eId,AcDb::kForRead) != Acad::eOk)
//<-
//->вариант 2
pCurve.open(eId,AcDb::kForRead);
if (pCurve.openStatus() != Acad::eOk)
//<-
acedAlert(_T("Это не кривая"));
else
res = false;
}
while(true)
{
acedInitGet (RSG_OTHER, _T("Р Д Т Ч"));
switch (acedGetKword(_T("\n[<Раз>/Два/Три/Четыре]: "), mode))
{
case RTCAN:
case RTERROR:
acedRestorePreviousUCS();
return;
case RTNONE:
_tcscpy(mode,_T("Р"));
break;
}
acedInitGet(RSG_NONULL,NULL);
if(acedGetPoint(NULL,_T("\nПервая точка: "),asDblArray(ptFrom))!=RTNORM)break;
pCurve->getClosestPointTo(ptFrom,ptFrom,Adesk::kFalse);
acedInitGet(RSG_NONULL,NULL);
if(acedGetPoint(asDblArray(ptFrom),_T("\nВторая точка: "),asDblArray(ptTo))!=RTNORM)break;
pCurve->getClosestPointTo(ptTo,ptTo,Adesk::kFalse);
}
acedRestorePreviousUCS();
}
ACED_ARXCOMMAND_ENTRY_AUTO(CRullerApp, LCTSoft, pointertest, pointertest, /*ACRX_CMD_TRANSPARENT*/ACRX_CMD_MODAL, NULL) // ни тот ни другой флаг не работают
[/code] |
|