.NET

Reply
Valued Contributor
Prakashdotc
Posts: 88
Registered: ‎03-03-2006
Message 1 of 4 (217 Views)

Passing parameters to command

217 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
Prakashdotc
Posts: 88
Registered: ‎03-03-2006
Message 2 of 4 (217 Views)

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
Message 3 of 4 (217 Views)

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
Message 4 of 4 (217 Views)

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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.