.NET

Reply
Valued Contributor
88 Posts
0 Kudos
Registered: ‎03-03-2006
Post 1 of 4

Passing parameters to command

240 Views, 3 Replies
03-23-2006 04:00 AM
Hi,
I'm creating User defined command for AutoCad call 'CREATECIRCLE' and function to handle as given below

AcadApp.DocumentManager.MdiActiveDocument.SendStringToExecute("createline ",false,false,false);

which in turn call's the command function

[Autodesk.AutoCAD.Runtime.CommandMethod("CREATECIRCLE")]
public void DrawCircle()
{
------------
------------
}

for this, it is possible to pass parameters as such

AcadApp.DocumentManager.MdiActiveDocument.SendStringToExecute("createline gx, gy ",false,false,false);
Valued Contributor
88 Posts
0 Kudos
Registered: ‎03-03-2006
Post 2 of 4

Re: Passing parameters to command

03-23-2006 04:03 AM in reply to: Prakashdotc
sorry actual code is as like

AcadApp.DocumentManager.MdiActiveDocument.SendStringToExecute("createcircle ",false,false,false);

and it's command function is

[Autodesk.AutoCAD.Runtime.CommandMethod("CREATECIRCLE")]
public void DrawCircle()
{
..........
..........
}
*Fred Chateau
Post 3 of 4

Re: Passing parameters to command

03-23-2006 09:10 AM in reply to: Prakashdotc
wrote ...

> ...it is possible to pass parameters as such

> ...SendStringToExecute("createline gx, gy ",false,false,false);


I'm new at ObjectARX programming so this basically a guess:

SendStringToExecute("createline " + gxParm + ", " + gyParm +
"\n",false,false,false);

where gxParm and gyParm are member Fields/Properties within your custom
Command class.

You should include the "\n" only if the AutoCAD command processor requires
it.

--
Regards,

Fred Chateau
*Fred Chateau
Post 4 of 4

Re: Passing parameters to command

03-23-2006 09:28 AM in reply to: Prakashdotc
"Fred Chateau" wrote ...

SendStringToExecute("createline " + gxParm + ", " + gyParm +
"\n",false,false,false);

where gxParm and gyParm are member Fields/Properties within your custom
Command class.

It just occurred to me that your question involves sending this string to
execute your own custom command. If that is the case, you shouldn't need to
include the parameters in the string; just access the parameters as
createline class Properties and use them directly in your custom Command
method.

[Autodesk.AutoCAD.Runtime.CommandMethod("CREATECIRCLE")]
public void DrawCircle()
{
------------
result = ArxMethod.BeginDraw(createline.gxParm, createline.gyParm);
------------
}

--
Regards,

Fred Chateau
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!