.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Passing parameters to command

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
646 Views, 3 Replies

Passing parameters to command

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);
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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()
{
..........
..........
}
Message 3 of 4
Anonymous
in reply to: Anonymous

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
Message 4 of 4
Anonymous
in reply to: Anonymous

"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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost