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

Load and run Vlisp program in C#.NET

8 REPLIES 8
Reply
Message 1 of 9
connieleo
573 Views, 8 Replies

Load and run Vlisp program in C#.NET

Could I load and run Vlisp program in C#.NET? Thanks a lot.
8 REPLIES 8
Message 2 of 9
jankoezb
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 🙂

Janko Jerinic
Message 3 of 9
connieleo
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
Message 4 of 9
Anonymous
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
:)

Janko Jerinic
Message 5 of 9
jankoezb
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 🙂

Thanks again,
Janko Jerinic
Message 6 of 9
jankoezb
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
Message 7 of 9
connieleo
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.
Message 8 of 9
dmarcotte4
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);
}
}
}
Message 9 of 9
connieleo
in reply to: connieleo

Thanks a lot. It's run.

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