asDblArray(tempPt));
// The point we just got is in UCS coordinates, but
// AcDbEllipse works in WCS, so convert the point.
//
rbFrom.restype = RTSHORT;
rbFrom.resval.rint = 1; // from UCS
rbTo.restype = RTSHORT;
rbTo.resval.rint = 0; // to WCS
acedTrans(asDblArray(tempPt), &rbFrom, &rbTo,
Adesk::kFalse, asDblArray(tempPt));
// Now you need to get the current UCS z-Axis to be used
// as the normal vector for the ellipse.
//
AcGeVector3d x =
acdbHostApplicationServices()->workingDatabase()->ucsxdir();
AcGeVector3d y =
acdbHostApplicationServices()->workingDatabase()->ucsydir();
AcGeVector3d normalVec = x.crossProduct(y);
normalVec.normalize();
// Create an AsdkEllipseJig object passing in the
// center point just selected by the user and the normal
// vector just calculated.
//
AsdkEllipseJig *pJig
= new AsdkEllipseJig(tempPt, normalVec);
// Now start up the jig to interactively get the major
// and minor axes lengths.
//
pJig->doIt();
// Now delete the jig object, since it is no longer needed.
//
delete pJig;
}
void
initApp()
{
acedRegCmds->addCommand("ASDK_VISUAL_ELLIPSE",
"ASDK_VELLIPSE", "VELLIPSE", ACRX_CMD_MODAL,
createEllipse);
}
void
unloadApp()
{
acedRegCmds->removeGroup("ASDK_VISUAL_ELLIPSE");
}
extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)
{
switch (msg) {
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(appId);
acrxDynamicLinker->registerAppMDIAware(appId);
initApp();
break;
case AcRx::kUnloadAppMsg:
unloadApp();
}
return AcRx::kRetOK;
}