.NET

.NET

Reply
Active Contributor
29 Posts
0 Kudos
Registered: ‎04-14-2005
Post 1 of 9

Load and run Vlisp program in C#.NET

157 Views, 8 Replies
11-21-2005 12:37 AM
Could I load and run Vlisp program in C#.NET? Thanks a lot.
Valued Contributor
51 Posts
0 Kudos
Registered: ‎10-31-2005
Post 2 of 9

Re: Load and run Vlisp program in C#.NET

11-22-2005 04:12 AM in reply to: connieleo
I suppose you could, but all I can think of is passing AutoCAD the command to load & run a Vlisp program by means of SendStringToExecute(..) method. However, I guess you can't turn off the unpleasant echo that the method generates. Do you know a way to do sort of a verbose command sending, it could be useful. If you do please tell me how :smileyhappy:

Janko Jerinic
Active Contributor
29 Posts
0 Kudos
Registered: ‎04-14-2005
Post 3 of 9

Re: Load and run Vlisp program in C#.NET

11-22-2005 04:34 AM in reply to: connieleo
Thanks for your answer. I will try it. : )

Could you explain it in detail? How to SendStringToExecute in the command line and run it? Message was edited by: connieleo
*Maksim Sestic
Post 4 of 9

Re: Load and run Vlisp program in C#.NET

11-22-2005 09:05 AM in reply to: connieleo

Janko, you may try setting system variables
CMDECHO to 0 and NOMUTT to 1 before issuing a
SendStringToExecute().

 

Regards,

Maksim Sestic

 

I suppose you could, but all I
can think of is passing AutoCAD the command to load & run a Vlisp program by
means of SendStringToExecute(..) method. However, I guess you can't turn off the
unpleasant echo that the method generates. Do you know a way to do sort of a
verbose command sending, it could be useful. If you do please tell me how
:smileyhappy:

Janko Jerinic
Valued Contributor
51 Posts
0 Kudos
Registered: ‎10-31-2005
Post 5 of 9

Re: Load and run Vlisp program in C#.NET

11-23-2005 04:14 AM in reply to: connieleo
Thank you so much Maksim! I figured there must be a way to do that, but I couldn't find out how, mostly because the verb "mutter" wasn't my first choice when querying help files :smileyhappy:

Thanks again,
Janko Jerinic
Valued Contributor
51 Posts
0 Kudos
Registered: ‎10-31-2005
Post 6 of 9

Re: Load and run Vlisp program in C#.NET

11-23-2005 04:24 AM in reply to: connieleo
Well, look it up in the .NET API docs. Full name of the method is:
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(..)
You pass it a string containing the command and params and some booleans, look it up. For example.

SendStringToExecute("select\nr\nall", false, false, false)

will deselect all selected objects in the active document, you separate the command and the params with line break symbols.

Janko Jerinic
Active Contributor
29 Posts
0 Kudos
Registered: ‎04-14-2005
Post 7 of 9

Re: Load and run Vlisp program in C#.NET

11-24-2005 09:08 PM in reply to: connieleo
Could anyone tell me how to run lisp in c#.net.I search it. I found someone can do it.

http://discussion.autodesk.com/thread.jspa?messageID=4947476

Could anyone teach me? I attach the lisp file sample. Thanks a lot.
Distinguished Contributor
195 Posts
0 Kudos
Registered: ‎04-02-2005
Post 8 of 9

Re: Load and run Vlisp program in C#.NET

11-25-2005 06:38 AM in reply to: connieleo
Here is an example of how to run your lisp from C#.
Have lot's of fun

Daniel

using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;

namespace MyFirstCommand
{
public class MyFirstCommandClass
{
[CommandMethod("RunLENOF")]
public void CommandRunLENOF()
{
AcadApp.DocumentManager.MdiActiveDocument.SendStringToExecute("LENOF" + "\x0020", true, false, true);
}
}
}
Active Contributor
29 Posts
0 Kudos
Registered: ‎04-14-2005
Post 9 of 9

Re: Load and run Vlisp program in C#.NET

11-26-2005 04:14 AM in reply to: connieleo
Thanks a lot. It's run.
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!