Hi guys,
I need your help. I use the following two function to set up the key words in the new command in my plugin:
acedInitGet(0, ACRX_T("noBendinglines Kfactor"));
acedEntSel("\n Pick a sheetmetal solid[noBendinglines/Kfactor]", ent_name, asDblArray(pickPnt)))
From the comand line, I can see the listed key two words:"noBendlinglines" and "Kfactor". But when I double click any key word, my program doesn't catch the return parameter value "RTKWORD". Basically there is no return from the function "acedEntSel". Could anyone please help me? I am stuck there.
Regards
John
Solved! Go to Solution.
Solved by loic.jourdan. Go to Solution.
Double clicking on a keyword in a command prompt does not enter it. You have to type it (or select it from a context menu).
Perhaps someone can help if you post code that demonstrates the problem
Hi guys,
below is the code snippet. Please note the function acedEntSel and acedInitGet I have in the codes. I appreciate if anyone can pass me the code snippet to do the same thing.
I am stuck here and thank you very much for your help.
Regards
John
bool show_bending_line_flag = false;
Acad::ErrorStatus acadReturnValue = Acad::eOk;
int errStat = RTERROR;
ads_name sset;
AcGePoint3d pickPnt;
struct resbuf org_osnap;
acedGetVar(ACRX_T(
"OSMODE"), &org_osnap);
struct resbuf new_osnap = org_osnap;
new_osnap.resval.rint = 0;
int dbg = 2;
acedSetVar(ACRX_T("OSMODE"), &new_osnap);
acedInitGet(0, ACRX_T("noBendinglines Kfactor"));
double k_factor = get_k_factor();
ostringstream ostr;
ostr << k_factor;
AcString kstr(ostr.str().c_str());
AcString tmp_prompt("\n Pick a sheetmetal solid[noBendinglines/Kfactor]");
AcString propmt = tmp_prompt;
//+ kstr + cend;
//acedInitGet(0, ACRX_T("K-Factor"));
int ic = 0;
while ((errStat != RTNORM) && (errStat != RTCAN) && (errStat != RTREJ) && (errStat != RTNONE))
{
ads_name ent_name;
switch(subType)
{
case AcDb::kNullSubentType:
for (;;)
{
switch (acedEntSel(propmt, ent_name, asDblArray(pickPnt)))
{
case RTNORM:
break; // get the solid name in the codes below
case RTKWORD:
// read the key wordname and check whether user want to show bending line
ACHAR kw[20];
if (_tcscmp(kw, _T("noBendinglines")) == 0)
{
ostr << k_factor;
AcString kstr(ostr.str().c_str());
if( ic %2 == 0 )
{
AcString tmp_prompt0("\n Pick a sheetmetal solid[Bendinglines/Kfactor]<Kfactor=");
AcString cend(">");
propmt = tmp_prompt + kstr + cend;
show_bending_line_flag = true;
}
else
{
AcString tmp_prompt0("\n Pick a sheetmetal solid[noBendinglines/Kfactor]<Kfactor=");
AcString cend(">");
propmt = tmp_prompt + kstr + cend;
show_bending_line_flag =false;
}
ic++;
}
if (_tcscmp(kw, _T("Kfactor")) == 0)
{
std::string str("\nEnter K-Factor<");
ostringstream ostr;
ostr << k_factor;
double backup_k_factor = k_factor;
string txt = str + ostr.str() +">:";
AcString astr(txt.c_str());
int err = acedGetReal(astr.kTCharPtr(), &k_factor);
ostr << k_factor;
AcString kstr(ostr.str().c_str());
AcString tmp_prompt("\n Pick a sheetmetal solid[noBendinglines/Kfactor]<Kfactor=");
AcString cend(">");
propmt = tmp_prompt + kstr + cend;
}
default:
break;
}
break;
}
//errStat = acedEntSel(ACRX_T("\n Pick a sheetmetal solid[bendinglines/kfactor]\n"), ent_name, asDblArray(pickPnt));
//if (errStat == RTKWORD)
// dbg = 2;
break;
default:
acutPrintf(ACRX_T("\n getPath: unsupported subentity type: %d\n"), subType);
return Acad::eInvalidInput;
}
if (errStat == RTERROR)
{
struct resbuf buf_errno;
acedGetVar(ACRX_T(
"ERRNO"), &buf_errno);
if (buf_errno.resval.rint == OL_ENTSELNULL) errStat = RTNONE;
}
}
Hi,
I see two points that may be fixed:
- First `acedInitGet(...);` has to be called right before each call to `acedEntSel`, in you case, right before your switch. Otherwise, the keywords won't be available for next `acedEntSel` calls.
- Second: you never get the value of the keyword, you declare `ACHAR kw[20];` and compare it right after without getting its actual value. You have to call `acedGetInput()` to fill in your kw variable with the actual input keyword.
Except that, I've ran it approximatively successfully (at least, I've got the code in `switch/case RTKWORD` executed correctly)
I hope this helps