Jump to content

VB.Net Thumbnail Challenge


CaveMan

Recommended Posts

@ Tharwat -

 

FYI - Downloading and installing the SDK, & Template(s) is not required to write .NET code (C#/VB) for AutoCAD.

 

VB.NET Example:

 

[color=blue][font=Consolas][color=blue][font=Consolas][color=blue][font=Consolas][font=Consolas][color=#000000][color=blue][font=Consolas][color=blue][font=Consolas]Imports[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.ApplicationServices[/color][/font]
[color=blue][font=Consolas]Imports[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.DatabaseServices[/color][/font]
[color=blue][font=Consolas]Imports[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.EditorInput[/color][/font]
[color=blue][font=Consolas]Imports[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.Runtime[/color][/font]

[color=green][font=Consolas]' [/font][/color][color=green][font=Wingdings][font=Wingdings]ß[/font][/font][/color][color=green][font=Consolas] Additional Imports as necessary[/font][/color]

[color=blue][font=Consolas]Public [/font][/color][font=Consolas][color=blue]Class [/color][color=#2b91af]Commands[/color][/font]

[font=Consolas][color=#000000]  <[/color][color=#2b91af]CommandMethod[/color][color=#000000]([/color][color=#a31515]"HelloWorld"[/color][color=#000000])> _[/color][/font]
[font=Consolas][color=blue]  Public [/color][color=blue]Sub[/color][color=#000000] HelloWorld()[/color][/font]
[font=Consolas][color=blue]      Dim[/color][color=#000000] ed = [/color][color=#2b91af]Application[/color][color=#000000].DocumentManager.MdiActiveDocument.Editor[/color][/font]
[font=Consolas][color=#000000]      ed.WriteMessage([/color][color=#a31515]"Hello World! "[/color][color=#000000])[/color][/font]
[font=Consolas][color=blue]  End [/color][color=blue]Sub[/color][/font]

[color=blue][font=Consolas]End [/font][/color][font=Consolas][color=blue]Class[/color][/font]
[/font][/color][/color][/font][/font][/color][/font][/color][/font][/color]

 

C#.NET Example:

 

[color=blue][font=Consolas][color=blue][font=Consolas][color=blue][font=Consolas][color=blue][font=Consolas]using[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.ApplicationServices;[/color][/font]
[color=blue][font=Consolas]using[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.DatabaseServices;[/color][/font]
[color=blue][font=Consolas]using[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.EditorInput;[/color][/font]
[color=blue][font=Consolas]using[/font][/color][font=Consolas][color=#000000] Autodesk.AutoCAD.Runtime;[/color][/font]

[color=green][font=Consolas]// [/font][/color][color=green][font=Wingdings][font=Wingdings]ß[/font][/font][/color][color=green][font=Consolas] Additional using as necessary[/font][/color]

[color=blue][font=Consolas]namespace[/font][/color][font=Consolas][color=#000000] MyCSAcadApp[/color][/font]
[font=Consolas][color=#000000]{[/color][/font]
[font=Consolas][color=blue]public [/color][color=blue]class [/color][color=#2b91af]Class1[/color][/font]
[font=Consolas][color=#000000]   {[/color][/font]
[font=Consolas][color=green]       // Defin command "MYCSCommand"[/color][/font]
[font=Consolas][color=#000000]       [[/color][color=#2b91af]CommandMethod[/color][color=#000000]([/color][color=#a31515]"MYCSCommand"[/color][color=#000000])][/color][/font]
[font=Consolas][color=blue]       static [/color][color=blue]public [/color][color=blue]void[/color][color=#000000] CMd1()[/color][/font]
[font=Consolas][color=#000000]       {[/color][/font]
[font=Consolas][color=green]           // Main code[/color][/font]
[font=Consolas][color=#2b91af]           Editor[/color][color=#000000] ed = [/color][color=#2b91af]Application[/color][color=#000000].DocumentManager.MdiActiveDocument.Editor;[/color][/font]
[font=Consolas][color=#000000]           ed.WriteMessage([/color][color=#a31515]"\nMy First command implemented in CSharp .NET Express Edition"[/color][color=#000000]);[/color][/font]
[font=Consolas][color=#000000]       }[/color][/font]
[font=Consolas][color=#000000]   }[/color][/font]
[font=Consolas][color=#000000]}[/color][/font]
[/font][/color][/font][/color][/font][/color]

 

** Note - AcDbMgd.dll, and AcMgd.dll references required (Copy Local = False)

Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    7

  • irneb

    7

  • CaveMan

    4

  • Jeff H

    3

Top Posters In This Topic

Posted Images

Yes, you don't need it for actually making dot net stuff (it is needed for C++ ARXs though). It just makes it a lot simpler and you get the correct help files - though that's now available as part of the on-line help.

 

If you don't download and install the SDK you'll need to set the reference path(s) in VB/C# to your acad's program folder and manually reference the AcMgd.DLL and AcDbMgd.DLL in your project. Otherwise those "using Adesk....." (in C#) and "Imports Adesk...." (in VB.Net) lines would cause errors (to start off with).

 

If you then also want it to be able to debug, you'll need to manually add the portion as per RenderMan's previous post. Be careful though as that file's an XML file and if you don't do it correctly it can get broken.

 

The wizard sets all these things up for you when you create the project.

 

An alternative way would be to create one like this then save it as a template in VB/C#. Then you can select that template whenever you start a new project.

Link to comment
Share on other sites

Thank you gentlemen .

 

It seems to me that it is not easy at all to start to the .net as we have just started with lisp due to lots of reasons that they have got to be gathered and settled well before diving into it and explore it as well as I did with lisp and Vlisp and so on .

 

How it's been said and distributed in the public that the Visual basic is dead with cad and it is no more used with it ? And here it goes the .net using the visual basic with more powerful tools and more professional techniques added to it to be side by side with the latest technology supporting Autocad and some other Applications in general ?

 

Great thanks for you all.

Link to comment
Share on other sites

You're correct that .NET development is not exactly an easy transition coming from LISP. It's an entirely different dynamic... similar only (as I understand it) in that it is Object-based.

 

How it's been said and distributed in the public that the Visual basic is dead with cad and it is no more used with it ? And here it goes the .net using the visual basic with more powerful tools and more professional techniques added to it to be side by side with the latest technology supporting Autocad and some other Applications in general ?

 

First, VBA ==/== Visual Basic .NET

 

Second, VBA isn't literally dead, per-se. Instead it is simply no longer being supported by Microsoft, and will ultimately die by attrition as developers stop using it (VBA) in favor for VB.NET (or another 'flavor'). Hence the VBAIDE being a separate install for newer AutoCAD versions, etc.

 

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...