[ZwCAD2012 - ZRX]
14-06-2012 07:36 . pm | View his/her posts only
Hello
can you someone to help me?
I have an example code "HelloWorld" in MVS2010 (C++):
// HelloWorld.cpp :
#include "stdafx.h"
#include "tchar.h"
#include
#include
void initApp();
void unloadApp();
void helloWorld();
void initApp()
{
// register a command with the AutoCAD command mechanism
acedRegCmds->addCommand("HELLOWORLD_COMMANDS", "Hello", "Hello", ACRX_CMD_TRANSPARENT, helloWorld);
}
void unloadApp()
{
acedRegCmds->removeGroup("HELLOWORLD_COMMANDS");
}
void helloWorld()
{
acutPrintf("\nHello World!");
}
/*
int helloWorld()
{
acutPrintf("\nHello World!");
return 1;
}
*/
extern "C" AcRx::AppRetCode
zcrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
switch (msg)
{
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(pkt);
acrxRegisterAppMDIAware(pkt);
initApp();
break;
case AcRx::kUnloadAppMsg:
unloadApp();
break;
default:
break;
}
return AcRx::kRetOK;
}
and I want you "int" not "void"... what I should to do?
best regards,
Zibi
can you someone to help me?
I have an example code "HelloWorld" in MVS2010 (C++):
// HelloWorld.cpp :
#include "stdafx.h"
#include "tchar.h"
#include
#include
void initApp();
void unloadApp();
void helloWorld();
void initApp()
{
// register a command with the AutoCAD command mechanism
acedRegCmds->addCommand("HELLOWORLD_COMMANDS", "Hello", "Hello", ACRX_CMD_TRANSPARENT, helloWorld);
}
void unloadApp()
{
acedRegCmds->removeGroup("HELLOWORLD_COMMANDS");
}
void helloWorld()
{
acutPrintf("\nHello World!");
}
/*
int helloWorld()
{
acutPrintf("\nHello World!");
return 1;
}
*/
extern "C" AcRx::AppRetCode
zcrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
switch (msg)
{
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(pkt);
acrxRegisterAppMDIAware(pkt);
initApp();
break;
case AcRx::kUnloadAppMsg:
unloadApp();
break;
default:
break;
}
return AcRx::kRetOK;
}
and I want you "int" not "void"... what I should to do?
best regards,
Zibi
[ZwCAD2012 - ZRX]
18-06-2012 02:34 . pm | View his/her posts only
That must not mean that it makes no sense ...
In version MSV2008, such a record run without problems.
I have a function to handle the hardware key, which is of type INT.
I can not change, so what do I do?
What makes changes where these changes are not needed and pose additional problems?
In version MSV2008, such a record run without problems.
I have a function to handle the hardware key, which is of type INT.
I can not change, so what do I do?
What makes changes where these changes are not needed and pose additional problems?
[ZwCAD2012 - ZRX]
20-06-2012 04:15 . pm | View his/her posts only
Wake up Chinese guy!
It's 10am
What you propose to do with my problem? Any ideas?
Maybe you can send me an example, where the function is not a "void" and return some values?
Good example will be also:
run from command (LISP to ARX):
(MyArx 7 8 "test")
and after then, Arx return to LISP eg.:
- (1 2 3 "abc" (4 5))
It's 10am
What you propose to do with my problem? Any ideas?
Maybe you can send me an example, where the function is not a "void" and return some values?
Good example will be also:
run from command (LISP to ARX):
(MyArx 7 8 "test")
and after then, Arx return to LISP eg.:
- (1 2 3 "abc" (4 5))
[ZwCAD2012 - ZRX]
25-06-2012 04:50 . pm | View his/her posts only
Post Last Edit by peimen8012 at 2012-6-25 16:54
LispBridge.rar (9.1 KB)
Hi, please refer to the attached file. It shows how to communicate with ZRX and Lisp. Sorry for the late reply.
Hi, please refer to the attached file. It shows how to communicate with ZRX and Lisp. Sorry for the late reply.
[ZwCAD2012 - ZRX]
25-06-2012 05:26 . pm | View his/her posts only
Post Last Edit by Zibster at 2012-6-25 17:36
drx.zip (3.25 KB)
In attached, you have an example.
I can't to give more, but this code working properly in ZwCAD2012 (DRX).
How convert this code to ZwCAD2012+ ??
Look at my first post.
In attached, you have an example.
I can't to give more, but this code working properly in ZwCAD2012 (DRX).
How convert this code to ZwCAD2012+ ??
Look at my first post.
[ZwCAD2012 - ZRX]
25-06-2012 07:09 . pm | View his/her posts only
In order to be more compatible with ARX, ZRX in ZWCAD+ have some changes. So maybe some programs written in old ZRX need to be modified when porting to ZWCAD+. Please refer to attached sample which shows how to define a lisp function in ZRX. Sorry for any inconvenience.
[ZwCAD2012 - ZRX]
25-06-2012 08:00 . pm | View his/her posts only
Thank you for example.
Compilation is without problems (SDK ZwCAD2012+).
But how this run?
Declared two fucntions:
/* Here we define the array of function names and handlers. */
static struct func_entry func_table[] =
{ {/*MSG0*/"fact", fact},
{/*MSG0*/"sqr", squareroot}, };
Appload "fact.zrx" and, command line:
Command: squareroot
Unknown command "SQUAREROOT". Press F1 for help.
Command: (squareroot)
; error: no function definition: SQUAREROOT
Command: (fact)
nil
Command: fact
Unknown command "FACT". Press F1 for help.
I greet
Compilation is without problems (SDK ZwCAD2012+).
But how this run?
Declared two fucntions:
/* Here we define the array of function names and handlers. */
static struct func_entry func_table[] =
{ {/*MSG0*/"fact", fact},
{/*MSG0*/"sqr", squareroot}, };
Appload "fact.zrx" and, command line:
Command: squareroot
Unknown command "SQUAREROOT". Press F1 for help.
Command: (squareroot)
; error: no function definition: SQUAREROOT
Command: (fact)
nil
Command: fact
Unknown command "FACT". Press F1 for help.
I greet
[ZwCAD2012 - ZRX]
26-06-2012 06:01 . pm | View his/her posts only
Hi,
thank you for example and help - great job
I have a new question - "resbuf return value":
acedRetReal(NKey1(x)); /* Call the function itself, and return the value to AutoLISP */
this above return one integer, what if I want to return a list eg. (1 2 3 "a" "b" "c")?
struct resbuf* pRbReturn = acutBuildList(RTLONG, NKey1(x), RTLONG, 2, RTLONG, 3, RTSTR, "a", RTSTR "b" , RTSTR "c", RTNONE);
acedRetList(pRbReturn);
what here??
/* Declaration function like this: */
int MyFunction (struct resbuf *rb);
/* Here we define the array of function names and handlers. */
static struct func_entry func_table[] =
{
{/*MSG0*/"fact", fact},
{/*MSG0*/"sqr", squareroot},
{/*MSGO*/"MyFunction", MyFunction},
};
and what here??
ads_real NKey (int x);
greetings
thank you for example and help - great job
I have a new question - "resbuf return value":
acedRetReal(NKey1(x)); /* Call the function itself, and return the value to AutoLISP */
this above return one integer, what if I want to return a list eg. (1 2 3 "a" "b" "c")?
struct resbuf* pRbReturn = acutBuildList(RTLONG, NKey1(x), RTLONG, 2, RTLONG, 3, RTSTR, "a", RTSTR "b" , RTSTR "c", RTNONE);
acedRetList(pRbReturn);
what here??
/* Declaration function like this: */
int MyFunction (struct resbuf *rb);
/* Here we define the array of function names and handlers. */
static struct func_entry func_table[] =
{
{/*MSG0*/"fact", fact},
{/*MSG0*/"sqr", squareroot},
{/*MSGO*/"MyFunction", MyFunction},
};
and what here??
ads_real NKey (int x);
greetings
[ZwCAD2012 - ZRX]
09-07-2012 04:34 . pm | View his/her posts only
The only thing should be changed is this:
int NKey (int x)
Please refer to attachment for detailed information.
[ZwCAD2012 - ZRX]
03-08-2012 04:20 . pm | View his/her posts only
Reply 21# peimen8012
Hi,
I declared:
extern int zcedQueueExpr(ZTCHAR * lisp_expr);
and code:
CString strCmdLisp;
strCmdLisp.Format(_T("(c:MyApp \"%s\" 2)"), strNameFile);
int a = zcedQueueExpr((ZTCHAR*)strCmdLisp.GetBuffer());
and error:
1>MyUtils.obj : error LNK2019: unresolved external symbol "int __cdecl zcedQueueExpr(char *)" (?zcedQueueExpr@@YAHPAD@Z) referenced in function "void __cdecl MyUtl_Function(class ATL::CStringT > >)" (?MyUtl_Function @@YAXV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z)
what is wrong?
Hi,
I declared:
extern int zcedQueueExpr(ZTCHAR * lisp_expr);
and code:
CString strCmdLisp;
strCmdLisp.Format(_T("(c:MyApp \"%s\" 2)"), strNameFile);
int a = zcedQueueExpr((ZTCHAR*)strCmdLisp.GetBuffer());
and error:
1>MyUtils.obj : error LNK2019: unresolved external symbol "int __cdecl zcedQueueExpr(char *)" (?zcedQueueExpr@@YAHPAD@Z) referenced in function "void __cdecl MyUtl_Function(class ATL::CStringT
what is wrong?
[ZwCAD2012 - ZRX]
11-09-2012 04:19 . pm | View his/her posts only
Post Last Edit by Zibster at 2012-9-11 16:21
What should be here?
What should be here?
view
If I have Yes(/Zc:wchar_t), I get an error:
1>c:\objectarx\zrxsdk 2012 plus_beta_2\arxport\..\inc\zAcPublishReactors.h(80): error C2664: 'strlen' : cannot convert parameter 1 from 'const ZTCHAR *' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
When I switch to Yes(/Zc:wchar_t-), I get an error:
1>c:\objectarx\zrxsdk 2012 plus_beta_2\arxport\..\inc\zAdAChar.h(9): fatal error C1189: #error : Please use native wchar_t type (/Zc:wchar_t)
What is wrong?
Can someone show (print screen) properly configuration step by step for ZwCAD2012+?
[ZwCAD2012 - ZRX]
24-10-2012 06:31 . pm | View his/her posts only
I see, you have no idea what is going on in ZRX (ZwCAD2012+) ;]
this is wrong:
extern int zcedQueueExpr(ZTCHAR * lisp_expr);
shoud be:
extern "C" int zds_queueexpr(ZTCHAR * lisp_expr);
CString strCmdLisp;
strCmdLisp = _T("(MyLisp)");
int iStatus = zds_queueexpr((TCHAR*)strCmdLisp.GetBuffer());
But, this solution will work only for the fourth run.
Next we have message error and crash ZwCAD.
this is wrong:
extern int zcedQueueExpr(ZTCHAR * lisp_expr);
shoud be:
extern "C" int zds_queueexpr(ZTCHAR * lisp_expr);
CString strCmdLisp;
strCmdLisp = _T("(MyLisp)");
int iStatus = zds_queueexpr((TCHAR*)strCmdLisp.GetBuffer());
But, this solution will work only for the fourth run.
Next we have message error and crash ZwCAD.
error
Maybe somebody can tell, what is this??
Regards






Hoping that would not be a hard work.