as we know, there is a lisp command "flatten" in the CAD express tool, and I want to execute "flatten" in my ARX application, I searched the internet and found the following code:
resbuf *rb_in = acutBuildList(RTSTR,"c:flatten",RTNONE);
resbuf *rb_out = NULL;
int rc = acedInvoke(rb_in,&rb_out);
acutRelRb(rb_in);
acutRelRb(rb_out);
this works, but i can not add arguments like this,
resbuf *rb_in = acutBuildList(RTSTR,_T("c:flatten"),RTPICKS,ssName,RTNONE);
the comand line returns "too many arguments".
c:flatten does not accept any parameters, it will prompt for the selection set and hidden line removal and pass it on to acet-flatn; I'm not sure there is any way to do what you need with acedInvoke. Perhaps you could define an AutoLISP function, that would accept the selection set as a parameter and call acet-flatn with it?
@Anonymous wrote:
...I'm not sure there is any way to do what you need with acedInvoke...
With help of acedInvoke can be calling next types of lisp-functions:
a) functions with C: prefix
b) functions registered with (vl-acad-defun 'function_name)
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
thanks a lot, I tested my code on Acad2008 according your advice,but failed.
can you do me a favor ? what's wrong with my following code?
first, I modified the lisp file "FlattenSup.lsp" (in the attachment), I added "(vl-acad-defun 'acet-flatn)" in the end.
secondly,I write the following code in VS2005 with objectArx2008.
AcDbObjectId idNew = Acad_System::cloneObjects(idSpline);
ads_name ent;
if (Acad::eOk != acdbGetAdsName(ent,idNew))
{
return AcDbObjectId::kNull;
}
ads_name ssName;
ads_ssadd(NULL,NULL,ssName);
ads_ssadd(ent,ssName,ssName);
ads_name entLast,entNew;
ads_entlast(entLast);
resbuf *rb_in = acutBuildList(RTSTR,_T("acet-flatn"),RTPICKS,ssName,RTSHORT,0,RTNONE);
resbuf *rb_out = NULL;
int es = acedInvoke(rb_in,&rb_out);
acutPrintf(_T("\n%d"),es);//I am not sure here, why it always returns RTERROR.
acutRelRb(rb_in);
acutRelRb(rb_out);
ads_ssfree(ssName);
ads_entlast(entNew);
//Acad_System::SendCommand(_T("no "));
if (ads_name_equal(entLast,entNew))
{
// ads_entdel(ent);
return AcDbObjectId::kNull;
}
return AcDbObjectId(aname(entNew));
1. I hope your's code is calling from document context.
2. I hope this version of flattensup.lsp was loaded before you call acedInvoke
Other way is calling undocumented function acedEvaluateLisp():
int __cdecl acedEvaluateLisp(wchar_t const *str, struct resbuf *&result);
where str is a lisp-expression, and result is a result of evaluation of this lisp-expression
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Can't find what you're looking for? Ask the community or share your knowledge.