I'm having trouble migrating this command to arx 2015
acedCommand to acedCommandS or acedCommandC:
static int ads_cmd_son(void)
{
struct resbuf *rb = acedGetArgs () ;
int osmodo;
ACHAR auxt[30];
struct resbuf rb1;
acedGetVar(_T("OSMODE"), &rb1);
osmodo = rb1.resval.rint;
rb1.resval.rint = 0;
acedSetVar(_T("OSMODE"), &rb1);
while (rb != NULL) {
if(rb->restype == RTREAL) {
acdbRToS(rb->resval.rreal,2,8,auxt);
acedCommand(RTSTR, auxt, RTNONE);
}
if(rb->restype == RTPOINT) acedCommand(rb->restype, rb->resval.rpoint, RTNONE);
if(rb->restype == RTSHORT) {
acdbRToS((ads_real)rb->resval.rint,2,0,auxt);
acedCommand(RTSTR, auxt, RTNONE);
}
if(rb->restype == RTANG) {
acdbRToS(rb->resval.rreal,2,8,auxt);
acedCommand(RTSTR, auxt, RTNONE);
}
if(rb->restype == RTSTR) acedCommand(rb->restype, rb->resval.rstring, RTNONE);
if(rb->restype == RTENAME) acedCommand(rb->restype, rb->resval.rlname, RTNONE);
if(rb->restype == RTPICKS) acedCommand(rb->restype, rb->resval.rlname, RTNONE);
if(rb->restype == RTORINT) {
acdbRToS(rb->resval.rreal,2,8,auxt);
acedCommand(RTSTR, auxt, RTNONE);
}
if(rb->restype == RT3DPOINT) acedCommand(rb->restype, rb->resval.rpoint, RTNONE);
if(rb->restype == RTLONG) {
acdbRToS(rb->resval.rlong,2,0,auxt);
acedCommand(RTSTR, auxt, RTNONE);
}
rb = rb->rbnext;
}
rb1.resval.rint = osmodo;
acedSetVar(_T("OSMODE"), &rb1);
if ( rb != NULL )
acutRelRb (rb) ;
return (RSRSLT) ;
}
What exactly did you have trouble with? The code you posted does not appear to have been migrated at all.
Exactly, I tried to migrate but got no success. I need help for this command...
This forum is primarily for peer-to-peer technical support. If you are searching for someone to do your programming work, you will probably have better luck in other forums where that sort of think is more common.
Hello, thank you,
I posted the code as a reference only, as I found with examples of codes using acedCommandC. Only superficial information.
Anyone know of any example code using this command?
AutoLISP:
(command "line")
(command '(0 0 0))
(command '(1 1 0))
(command "")
I want to do the same with acedCommandC ... can anyone help me?
Take a look at docs\readarx.chm in the ObjectARX SDK. The "acedcommand Migration" section includes sample code.
You're more likely to get help if you describe what you did (including your code), what you expect to happen, and what actually happens.
Hi,
This is not exactly a port of the code that you shared, but can help understand the acedCommandC usage for a Line command.
static void AdskMyCommand() { ads_point pt1; int rt = ads_getpoint(NULL, _T("\nSelect first point: "), pt1); int rs = acedCommandC(&PauseLoopLine, NULL, RTSTR, _T("_line"), RT3DPOINT, pt1, RTNONE); acutPrintf(ACRX_T("\nAfter acedCommandC call...")); } static int PauseLoopLine(void * pData) { if (acedCmdCWasCancelled()) { acutPrintf(ACRX_T("\nPauseLoopLine - acedCommandC cancelled...")); return 0; } if(isLineActive()) { int rs = acedCommandC(&PauseLoopLine, NULL, RTSTR, PAUSE, RTNONE); acedCallBackOnCancel(); acutPrintf(ACRX_T("\nPauseLoopLine - acedCommandC returned %d "), rs); return 1; } acutPrintf(ACRX_T("\nPauseLoopLine - Line is not Active, so calling *CallWhenLineDone* ")); CallWhenLineDone(); return 0; } static void CallWhenLineDone() { acutPrintf(ACRX_T("\nCallWhenLineDone - Line done")); } static Adesk::Boolean isLineActive() { struct resbuf rb; acedGetVar(_T("CMDNAMES"),&rb); if (_tcsstr(rb.resval.rstring, _T("LINE"))) return Adesk::kTrue; return Adesk::kFalse; }
Regards,
Balaji
just try to change acedCommand to acedCommandS. I don't know how and why 🙂 but it works even with pauses :):):)
for example, this code still simulate polyline creation command inside your ARX code.
#if defined(_MSC_VER) && (_MSC_VER > 1500) // VS2010, VS2012
#include "acedCmdNF.h"
#endif
...
if ( acedCommandS(RTSTR,_T("_pline"),RTSTR,PAUSE,RTNONE) == RTNORM ) { while( true ) { acedGetVar(_T("CMDNAMES"), &rb); CString cmd_now( rb.resval.rstring ); if ( cmd_ok != cmd_now ) { acedCommandS(RTSTR, PAUSE, 0); } else break; } }
if you need to support an older autocad versions, and don't want to create a pure arx code without any acedCmds, you have to use #if construction for each acedCommand in your code.
for example:
int res = RTFAIL; #if defined(_MSC_VER) && (_MSC_VER == 1500) // VS2008 res = acedCommand(RTSTR, ...); #elif defined(_MSC_VER) && (_MSC_VER > 1500) // VS2010, VS2012 res = acedCommandS(RTSTR, ...); #endif // analyze res here!!!