3

I need to write a command on the command line on Autocad 2000i and I want autocad to prompt for a parameter. Then my vb.net program will act based on the recieved parameter.

Basically I guess my solution is all here: http://through-the-interface.typepad.com/through_the_interface/2006/09/passing_argumen.html

Problem is, I cant find the reference to the Autodesk.AutoCAD.EditorInput namespace being used in there.

What am I missing here? Did EditorInput not exist in Autocad 2000i yet?


Thanks a lot for your answer.

I have a vb.net project which adds a toolbar to autocad. I want to let the user change the selected value of a combo in my toolbar, by writing a commnad and a parameter.

How can I use your method in my project? Do I put the dvb file in my project? Can the vba file be integrated in my vb.net project?

Thanks a lot in advance.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Tomer S
  • 39
  • 1
  • 5

2 Answers2

2

.Net API did not exist for AutoCAD back in 2000. Things were done through LISP or VBA or a combination of both. Here is a brief explanation of things to do.

the VBA-Only Way:

Open Tools > Macro > Visual Basic Editor (alt + F11)

Type your code:

Sub Test()

Dim str As String
str = InputBox("Enter radius:")

MsgBox str

End Sub

Type "-vbarun" in command prompt(without quotes)

Type "Thisdrawing.Test" (modulename.functionname)

the VBA + Lisp Way -(my preferred method)

Type your code in the editor as mentioned above. Save your vba file (.dvb format)..suppose it is in D:\Macros folder with the name MyDvb.dvb.

Create a new Lisp File(open a notepad and type the code below and save as .lsp extension) This lisp file will be used to call all the VBA macros.

(defun c:testcommand()
  (command "vbarun" "D:/Macros/MyDvb.DVB!ThisDrawing.Test")
)

now load this lisp for one time by typing "ap" at the command prompt. This helps us to keep the commands available for the session.

Type "testcommand" and you will see your code executed

vinayan
  • 1,597
  • 3
  • 19
  • 42
1

Here is how its done using .NET C#

// Ask the user to select a folder

        PromptResult res = ed.GetString("\nEnter the path of the folder: ");

        if (res.Status == PromptStatus.OK)
        {
            string[] filepaths = Directory.GetFiles(res.StringResult, "*.dwg", SearchOption.AllDirectories);
        }

Let me know if you have any questions.