[ZwCAD2012 - ZRX]

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 1 of 27

  [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
0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 7Rank: 7Rank: 7

Paul

Moderator

posts: 197

Registered: 2011-9-17

Message 2 of 27

[ZwCAD2012 - ZRX]
15-06-2012 05:34 . pm | View his/her posts only
Post Last Edit by mudcrab at 2012-6-15 17:46

TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 3 of 27

[ZwCAD2012 - ZRX]
15-06-2012 06:11 . pm | View his/her posts only
What you so happy?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

DDWZW

Newbie

posts: 144

Registered: 2011-11-23

Message 4 of 27

[ZwCAD2012 - ZRX]
18-06-2012 10:39 . am | View his/her posts only
Hi Zib
You cannot do like this because...
the value returned by the corresponding command function in ZRX has to be void. it does not make any sense to have this value, actually, not applicable
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 5 of 27

[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?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 6 of 27

[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))
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 7 of 27

[ZwCAD2012 - ZRX]
25-06-2012 02:34 . pm | View his/her posts only
I see that no one knows in support ZWSOFT, what is it a VC++...
I's really pathetic...

Where is a documentation?
Where are an examples?
How long should be waiting, to get a satisfying answer? ;/
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Alan

Newbie

posts: 4

Registered: 2011-5-24

Message 8 of 27

[ZwCAD2012 - ZRX]
25-06-2012 03:13 . pm | View his/her posts only
Post Last Edit by Alan at 2012-6-25 16:01

cool! So how to do?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 9 of 27

[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.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 10 of 27

[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.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 11 of 27

[ZwCAD2012 - ZRX]
25-06-2012 06:05 . pm | View his/her posts only
Your Project in Microsoft Visual Studio 2010 for ZwCAD 2012 +:
error C2065: 'ZCHAR' : undeclared identifier
error C2065: 'lisp_expr' : undeclared identifier

link
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 12 of 27

[ZwCAD2012 - ZRX]
25-06-2012 06:38 . pm | View his/her posts only
Reply 10# Zibster


This is clear. Please wait for a few minutes. I am perparing a sample to you.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 13 of 27

[ZwCAD2012 - ZRX]
25-06-2012 07:09 . pm | View his/her posts only
fact_dg.rar (94.66 KB)

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.

TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 14 of 27

[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

TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 15 of 27

[ZwCAD2012 - ZRX]
26-06-2012 09:53 . am | View his/her posts only
Reply 14# Zibster


It contains two functions:
(fact n) return the factorial of n
For example:
Command: (fact 6)
720.0

(sqr d) return the square root of d
For example:
Command: (sqr 2.0)
1.41421
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 16 of 27

[ZwCAD2012 - ZRX]
26-06-2012 02:39 . pm | View his/her posts only
Okey, it's work
Thank you - I will try to do the same in my functions.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 17 of 27

[ZwCAD2012 - ZRX]
26-06-2012 03:47 . pm | View his/her posts only
Hoping that would not be a hard work.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 18 of 27

[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


TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 19 of 27

[ZwCAD2012 - ZRX]
09-07-2012 04:34 . pm | View his/her posts only
fact_dg.rar (96.8 KB)

The only thing should be changed is this:
int NKey (int x)

Please refer to attachment for detailed information.
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Fernando

Newbie

posts: 19

Registered: 2011-9-23

Message 20 of 27

[ZwCAD2012 - ZRX]
23-07-2012 06:36 . pm | View his/her posts only

Hi,

extern
int zcedQueueExpr(ZCHAR * lisp_expr);

This declaration works in ZWCAD 2012, as would be in ZWCAD +2012.?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Arphone

Newbie

posts: 24

Registered: 2012-6-25

Message 21 of 27

[ZwCAD2012 - ZRX]
24-07-2012 09:39 . am | View his/her posts only
Hi arkitool,

Please try
extern int zcedQueueExpr(ZTCHAR * lisp_expr);
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

DDWZW

Newbie

posts: 144

Registered: 2011-11-23

Message 22 of 27

[ZwCAD2012 - ZRX]
24-07-2012 02:39 . pm | View his/her posts only
how are you doing Zibster?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 23 of 27

[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?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 24 of 27

[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?

view

zw.jpg
2012-9-11 16:20

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+?
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 25 of 27

[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.

error

zw_err.jpg
2012-10-24 18:29



Maybe somebody can tell, what is this??

Regards
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

seav735587

Newbie

posts: 9

Registered: 2012-9-7

Message 26 of 27

[ZwCAD2012 - ZRX]
25-10-2012 04:29 . pm | View his/her posts only
Did you try this:
acDocManager->sendStringToExecute(curDoc(), _T("(MyLisp)\n"));
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS

Rank: 1

Assgarth

Newbie

posts: 26

Registered: 2011-7-29

Message 27 of 27

[ZwCAD2012 - ZRX]
25-10-2012 06:11 . pm | View his/her posts only
No, I didn't, but I will try

EDIT:
Yeahh... it's work! Thank you seav735587.
Although it is limited to 256 characters, but it's enough.

Thanks again ;)
regards
TOP 0 Kudos
Reply Quote
Tags:ZRX, SDS