Compile code

Compile code

Automohan
Advocate Advocate
755 Views
5 Replies
Message 1 of 6

Compile code

Automohan
Advocate
Advocate

Need help to compile the code to run...

thanks

[CommandMethod("RecoverTest", CommandFlags.Session)]
publicvoid RecoverTest() // This method can have any name
{
    Document doc =
        Application.DocumentManager.MdiActiveDocument;
    DocumentCollection docs = Application.DocumentManager;
    Editor ed = doc.Editor;

    OpenFileDialog file =
        newOpenFileDialog("Select file to recover", null,
                            "dwg;dxf", "Recover",
          OpenFileDialog.OpenFileDialogFlags.DoNotTransferRemoteFiles);
             
    //show the dialog and take the dwg input
    System.Windows.Forms.DialogResult dr =  file.ShowDialog();
    if (dr != System.Windows.Forms.DialogResult.OK)
           return;
    try
    {
        //call  AppContextRecoverDocument to revover the selected DWG.
        docs.AppContextRecoverDocument(file.Filename);
    }
    catch
    {
        ed.WriteMessage("Unable to recover the drawing\n");
    }
}
"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
756 Views
5 Replies
Replies (5)
Message 2 of 6

Automohan
Advocate
Advocate

58743921739e7046b7d1f8490abc3602.png

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
Message 3 of 6

norman.yuan
Mentor
Mentor

Well, people may wonder why is this request/question?

 

Are you doing AutoCAD .NET API programming (that is this forum for)? If you do, you are supposed to be compile the code (and test-run the generated DLL). 

 

If you are to start learning AutoCAD .NET API and do not know how to compile the code, then, trust me, this code is not a good one for getting started. As for compiling code, you need to get a version of Visual Studio (community verison is free and more than good enough for AutoCAD .NET programming).

 

If you do not actually do .NET API programming, but do understand this code is to do somehow and want to use the custom command "RecoverTest" in real work, then there is no point to compile this code, load the generated DLL into AutoCAD and run the command "RecoverTest", because AutoCAD comes with built-in command "Recover", it does the exactly same work (or may be better), plus, you do not have to bother load extra DLL. That is, the code you showed here, which is originally from ADN development blog, as whole has no practical use value. It only meant to show that how the new API method AppContextRecoverDocument() can be called/used. So, many who do AutoCAD .NET programming here would scratch their head: what sense does compiling this code into a DLL make? 

 

If you really need help on something, provide more details, there could be more meaningful helps.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 4 of 6

Automohan
Advocate
Advocate

The Autocad command: "RECOVER" & this code both are same ???

So just the AutoCAD command: recover then run through many drawings without opening them & it's faster !

I am learning lisp & not going to learn VB, Net or other programs, it is too hard to learn all the programs, first of all I should have enough time to learn, i came here to only use some of the codes better than Autolisps, age also more + wearing eye glass, the hole day can't sit with the PC to learn & work - quickly you may come to see nothing by your eyes !

  • I have to Install Visual Studio
  • Have to learn how to compile

Can you compile & attach ...

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
Message 5 of 6

doaiena
Collaborator
Collaborator

A lot of the users here have spent a lot of time working and learning. It should not take you more than 2 hours to prepare the software and learn how to compile a .NET dll. You don't need to learn how to code a .NET plugin in order to compile it.

 

- Download Visual Studio Community

- Install it

- While it is downloading/installing watch the first 20 minutes of this video:

https://www.autodesk.com/autodesk-university/fr/forge-content/au_class-urn%3Aadsk.content%3Acontent%... 

 

By the time Visual Studio has been installed, you will already know how to compile a .NET dll for AutoCAD.

0 Likes
Message 6 of 6

Automohan
Advocate
Advocate

What is the software with make gif Image 

Example: attached

Block_from_attrib.gif

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes