Author Topic: Show me!!  (Read 8582 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Show me!!
« on: April 27, 2005, 12:24:13 PM »
Let's say I want to use .NET to customize AutoCAD.
Where do I start?
What do I need?
Do have any working code examples?
TheSwamp.org  (serving the CAD community since 2003)

TR

  • Guest
Show me!!
« Reply #1 on: April 27, 2005, 01:35:21 PM »
Good first topic.

First and formost you'll need either AutoCAD 2005 or 2006 (or a vertical product) to use .NET to customize AutoCAD. Both of these products install the .NET framework when you install AutoCAD so you won't have to download them.

The next and probably the most important thing is you'll need to decide which .NET language you want to use and get somewhat familiar with the language. There are tons of tutorials out there for all the languages of .NET. A simple google search of "c# tutorial" or "VB.net tutorial" should give you some good tutorials to get you familiar with the language.

For writing .NET you can code in almost any text editor and compile with the command line tools provided with the .NET framework. However, if you're like me and prefer a decent IDE I recommend SharpDevelop.

For some good tutorials for using with AutoCAD you can check out the C# articles that MickD posted on CadVault. There are also some VB.NET examples in the ObjectARX SDK under samples/dotnet.

I hope this is enough to get you started.

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Show me!!
« Reply #2 on: April 27, 2005, 02:04:09 PM »
So .NET isn't a language on it's own!! You mean I have to use it with-in another language?
TheSwamp.org  (serving the CAD community since 2003)

TR

  • Guest
Show me!!
« Reply #3 on: April 27, 2005, 02:21:33 PM »
Take a look at this.

It will explain how .NET is a framework and languages like C# and VB.NET run on that framework.

pmvliet

  • Guest
Show me!!
« Reply #4 on: April 27, 2005, 03:35:20 PM »
I know typing netload at the command line will let you load in a .net application  :D

But we all knew that already....

<back to reading the previous links>
Pieter

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Show me!!
« Reply #5 on: April 27, 2005, 06:51:51 PM »
I'm sure Mick would appreciate any constructive comments you guys would choose to leave.

regards
kwb
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Show me!!
« Reply #6 on: April 27, 2005, 08:57:19 PM »
Quote from: Tim Riley
Take a look at this.

It will explain how .NET is a framework and languages like C# and VB.NET run on that framework.


Quote
What is the .NET Framework?

The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET.


So what does the Internet and AutoCAD have in common? If .NET in "language-neutral" then why do I need C#?
TheSwamp.org  (serving the CAD community since 2003)

MP

  • Seagull
  • Posts: 17731
  • Have thousands of dwgs to process? Contact me.
Show me!!
« Reply #7 on: April 27, 2005, 09:02:26 PM »
Of all the Microsoft developed languages that can utilize the CLR, C# (arguably) is the best balance of power and elegance. More importantly, it is what Autodesk will provide the most support for (guess) and it has the largest user base if I'm not mistaken.

If one is thinking "Ooooh, but I've x years of solid development time in VB6, I should learn VB.Net" save yourself some grief. The learning curve for VB.Net is very similar to C#. VB.Net shares little with VB other than name and some syntax, but you'll just bring your bad VB habits (yes, you have some) along for the ride to VB.Net. Notwithstanding, I think M$ had an excellent opportunity to make VB.Net an improved version of VB, but they didn't. Instead they retaining some real lousy VB paradigms for no good reason (which they had initially intended to abandon); it's not like VB6 code magically ports seemlessly to VB.Net. Anyway, it would be better IMO opinion to just buck up and learn C#.

But I digress!
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

TR

  • Guest
Show me!!
« Reply #8 on: April 27, 2005, 10:53:34 PM »
Quote from: Mark Thomas
So what does the Internet and AutoCAD have in common? If .NET in "language-neutral" then why do I need C#?


Web Services are a part of .NET but they do not define .NET's capabilities. You can code stand alone applications that will run just as a C++ or JAVA program would.

By language-neutral they don't mean you can use any programming language under the sun. Think of it this way: Say MP coded a .NET assembly in C# that contained KickArseFunction1. I could could reference that assembly in BOO and use it as if it were native.

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Show me!!
« Reply #9 on: April 28, 2005, 09:43:33 AM »
Quote from: MP
Anyway, it would be better IMO opinion to just buck up and learn C#.
But I digress!

There are a lot of similarities between VB and C#.  Having learned VB a few years ago, when I started learning C#, I was amazed how similiar they are.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Show me!!
« Reply #10 on: April 28, 2005, 05:42:30 PM »
.. The biggest hurdle for some may be the Object Oriented Programming, and all that that involves. .. primarily discipline and planning.
This is not intended as a snobbish responce, just a heads up that some study will be required.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Show me!!
« Reply #11 on: April 29, 2005, 07:46:18 AM »
So I installed SharpDevelop and ObjectARX 2006, opened [ C:\ObjectARX 2006\samples\dotNet\Prompts\prompts.cs ] and hit the compile button. All I get is a bunch of errors. *sigh* I'd print the erros out but I don't believe you can.
TheSwamp.org  (serving the CAD community since 2003)

MickD

  • Gator
  • Posts: 3435
  • (x-in)->[process]->(y-out)
Show me!!
« Reply #12 on: April 29, 2005, 06:58:31 PM »
Hi Mark,
Although you open the solution, it has no way of knowing where your references to other assemblies (sorta like new age dll's) are to link to.
In the solution explorer right click on References then pick Add. Browse to your Autocad installation directory and pick the acdbmgd.dll and the acmdg.dll and add them to your project.
If you want to use activex, when adding a reference, open the COM tab and pick the 2 Autocad type lib's, 1 is the Autocad (version specific) type lib and the other the objectDBX type lib, then add those as well.
See if that helps.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Show me!!
« Reply #13 on: April 29, 2005, 07:02:35 PM »
Thanks Mick, that makes a lot of sense. Guess I just wanted that instant gratification. :)
TheSwamp.org  (serving the CAD community since 2003)

MikePerry

  • Guest
Re: Show me!!
« Reply #14 on: August 02, 2005, 05:57:28 AM »
Quote from: Mark Thomas
Let's say I want to use .NET to customize AutoCAD.
Where do I start?
What do I need?
Do have any working code examples?
Get started with .Net in AutoCAD 2006 by Mike Tuersley

Use .NET Editors to Create Simple AutoCAD commands by Mike Tuersley

Use C# to Create Simple AutoCAD commands by Mike Tuersley