.NET

Reply
Active Contributor
connieleo
Posts: 29
Registered: ‎04-14-2005
Message 1 of 9 (154 Views)

Load and run Vlisp program in C#.NET

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

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
connieleo
Posts: 29
Registered: ‎04-14-2005
Message 3 of 9 (154 Views)

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

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
jankoezb
Posts: 51
Registered: ‎10-31-2005
Message 5 of 9 (154 Views)

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
jankoezb
Posts: 51
Registered: ‎10-31-2005
Message 6 of 9 (154 Views)

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
connieleo
Posts: 29
Registered: ‎04-14-2005
Message 7 of 9 (154 Views)

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
dmarcotte4
Posts: 195
Registered: ‎04-02-2005
Message 8 of 9 (154 Views)

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
connieleo
Posts: 29
Registered: ‎04-14-2005
Message 9 of 9 (154 Views)

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