.NET

Reply
Active Contributor
cadplayer
Posts: 29
Registered: ‎11-23-2009
Message 11 of 16 (272 Views)

Re: C# How make a dll

04-19-2012 11:30 PM in reply to: cadplayer

What does it mean "clone of Microsofts major products"

For run Autocad Applikation on C sharp first step: build referens for ACDBMGD.DLL and ACMGD.DLL

number two: using method

 

using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;

public class HelloWorld
{
  [Autodesk.AutoCAD.Runtime.CommandMethod("HELLO")]
  public void HelloCommand()
  {
    acadApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage(_
      "Hello World FROM C#!");
    acadApp.UpdateScreen();
  }
}

 

Than I do debugging cs-format (it means also compile cs ->exe). But I want to have a dll to can load program in Autocad workflow. In Visual Studio produce automatically dll you can find in c:\...\ClassLibrary\bin\Debug\ if you starting your library with extern program and load acad.exe. But it´s not possible to do with Express. The reason is I don´t know why I should buy Visual Studio if all functions I can also do with Express. Can somebody explain how I can do a dll from cs file with Visual Express ?

 

/Dirk

*Expert Elite*
Alfred.NESWADBA
Posts: 9,598
Registered: ‎06-29-2007
Message 12 of 16 (268 Views)

Re: C# How make a dll

04-19-2012 11:58 PM in reply to: cadplayer

Hi,

 

>> What does it mean "clone of Microsofts major products"

E.g. that you don't use Microsoft's Visual Studio but >>>cSharp<<< instead. I think you already found it.

 

>> For run Autocad Applikation on C sharp first step: build referens for ACDBMGD.DLL and ACMGD.DLL

Sorry no. The fist step is to create a project, and the type of project has to be a DLL:

 

 

 

Check this first steps, then you can set the debug-options that when starting debugging the ACAD.EXE is started and you are able to netload your DLL now.

 

 

 

Good luck, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Mentor
KerryBrown
Posts: 278
Registered: ‎11-29-2008
Message 13 of 16 (263 Views)

Re: C# How make a dll

04-20-2012 12:14 AM in reply to: cadplayer

cadplayer wrote:

 

C# How make a dll

< .. > 

Sorry I´m absolute beginners in c#


If that is the case, don't try to build AutoCAD plugin's without learning the basics

of C# ( and .NET) first.

There are tons of C# tutorials available on the net that you can start with

and use to become familiar with the language.

 

Watch a couple of the AU videos related to programming.

 

Download the labs from AutoDesk ( 7 sessions) and work your way through those.

 

Read the forums ... there are several that have a great collection of code and AutoCAD related posts.

 

In short, you have to do the work to get the results.

 

Regards

Kerry

 

 

edit : added -  there are some references here that may be handy for you:

http://www.theswamp.org/index.php?topic=32381.0

 

 

 

 

 

 


 

//-------------------------------------------------------

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Active Contributor
cadplayer
Posts: 29
Registered: ‎11-23-2009
Message 14 of 16 (261 Views)

Re: C# How make a dll

04-20-2012 12:19 AM in reply to: Alfred.NESWADBA

Thanks Alfred, yes we comes nearly to my solutions. Take a look on second picture, the is register "Debuggen" . I can´t load Exeternal program ... acad.exe I can't find this opportunity in Visual Express. That is the reason for Autocad library is unusable with Visual Express (you can´t produce dll) or?

Sorry for my english, I´m not very well to describe thing in it.

 

@Kerry you´re right I am already 5 steps further.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,598
Registered: ‎06-29-2007
Message 15 of 16 (251 Views)

Re: C# How make a dll

04-20-2012 12:38 AM in reply to: cadplayer

Hi,

 

Sorry first about mentioning the wrong word for the alternative to MS-Visual Studio, it's name is SharpDevelop (>>>Wikipedia<<<).

And my screenshots (thinking of you are searching for and using an alternative) were done with SharpDevelop (4.2).

 

>> the is register "Debuggen" . I can´t load Exeternal program

That makes me thinking that you either use VS-Express (and not an alternative) or your project type is an EXE.

For VS-Express: The most easy way would be to get an existing project, and modify the CSPROJ-file (with notepad or any other ascii-editor)) like you can see it >>>here<<<. And then clear the code and input yours

 

>> That is the reason for Autocad library is unusable with Visual Express (you can´t produce dll) or?

Yes, you can, but a few steps has to be done to get project files prepared.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
cadplayer
Posts: 29
Registered: ‎11-23-2009
Message 16 of 16 (242 Views)

Re: C# How make a dll

04-20-2012 03:37 AM in reply to: Alfred.NESWADBA

Yes I get it. Now I have maked a dll :mantongue: thanks Alfred 

PS.: it´s much complicate as I think before

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.