// input may either return RTNORM (from command line) or RTMODELESS (from OPM) // if it is RTMODELSS, the entity already has that value set. // if it not RTMODELSS, we process as before, setting the value on m_pPoly void CPolyCommand::getInput() { ads_point tmpc; char tmpBuf[133]; if (!m_pPolyCmd->GotNumSides()) { int nSides; acedInitGet(INP_NNEG, ""); if ((m_retval = acedGetInt("\nEnter number of sides: ", &nSides)) == RTNORM) { if (nSides < 3) { acutPrintf("\nNeed at least 3 sides."); return; } m_pPoly->put_NumSides(nSides); } } else if (!m_pPolyCmd->GotCenter()) { if ((m_retval = acedGetPoint(NULL, "\nLocate center of polygon: ", tmpc)) == RTNORM) { AcAxPoint2d pt2d(tmpc[0],tmpc[1]); m_pPoly->put_Center(*pt2d.asVariantPtr()); } } else if (!m_pPolyCmd->GotStartPoint()) { AcAxPoint2d pt2dCtr(0.0,0.0); VARIANT *pVar = pt2dCtr.asVariantPtr(); m_pPoly->get_Center(pVar); pt2dCtr = pVar; ads_point cp = { pt2dCtr.x, pt2dCtr.y }; if ((m_retval = acedGetPoint(cp, "\nLocate start point of polygon: ", tmpc)) == RTNORM) { AcAxPoint2d pt2d(tmpc[0],tmpc[1]); if (pt2dCtr == pt2d) { acutPrintf("\nPick a point different from the center."); return; } m_pPoly->put_StartPoint(*pt2d.asVariantPtr()); } } else if (!m_pPolyCmd->GotTextString()) { if ((m_retval = acedGetString(Adesk::kTrue, "\nEnter polygon name: ",tmpBuf)) == RTNORM) { m_pPoly->put_TextString(_bstr_t(tmpBuf)); } } else if (!m_pPolyCmd->GotTextStyleName()) { if ((m_retval = acedGetString(Adesk::kTrue, "\nEnter text style: ", tmpBuf)) == RTNORM) { AcDbObjectId tsId; if (tmpBuf[0] == '\0' ) { // Get default text style struct resbuf result ; if ( acedGetVar ("TEXTSTYLE", &result) != RTNORM ) { acutPrintf( "\nError while reading default AutoCAD text style setting"); fail(); return; } strcpy (tmpBuf, result.resval.rstring) ; acdbFree (result.resval.rstring) ; } if ( rx_getTextStyleId(tmpBuf, acdbHostApplicationServices()->workingDatabase(), tsId) != Acad::eOk) { acutPrintf("\nInvalid text style name"); fail(); return; } m_pPoly->put_TextStyleName(_bstr_t(tmpBuf)); } } else m_bDone = true; if (m_retval != RTNORM && m_retval != RTMODELESS) fail(); }