473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Scuffle w AutoCAD programming using VB.NET (mainly)

Hello. Me and my colleagues are trying to program an AutoCAD application using VB.NET (actually, VB 2008). We followed the below procedure closely:

AutoCAD programming using VB.Net, C#.Net, AutoCAD Customization using Net


You can program AutoCAD using VB.Net/C#.Net using following methos:

1. Using ObjectARX managed wrapper classes
2. Using AutoCAD COM APIs
3. Using combination of both

If you are currently using AutoCAD VBA then you can use AutoCAD COM APIs to start AutoCAD programming using .Net immediately.

Procedure to use AutoCAD COM API with .Net is explained below:

- Start Microsoft Visual Studio 2005
- Create a new Class Library project in VB.Net
- Add reference to AutoCAD Type Library (acax17enu.tlb), AutoCAD / ObjectDBX Common Type Library (axdb17enu.tlb), acdbmgd.dll and acmgd.dll.
- Type the following code (This code creates a line)

Imports Autodesk.AutoCAD.Runtime

Public Class Class1
<'CommandMethod("MyLine")> _
Public Shared Sub CreateLine()

Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim acaddoc As Autodesk.AutoCAD.Interop.AcadDocument
Dim pt As Object
Dim pt1 As Object

AcadApp = GetObject(, "Autocad.Application")
acaddoc = AcadApp.ActiveDocument

pt = acaddoc.Utility.GetPoint(, "Pick point:")
pt1 = acaddoc.Utility.GetPoint(pt, "Pick second point:")

acaddoc.ModelSpace.AddLine(pt, pt1)

End Sub
End Class

- Build Solutions
- Start AutoCAD
- Give NetLoad command
- Select dll file created by above application
- Once the loading is completed you can give MyLine command to take the trial of above program.

__________________________________________________ ____

However, with all the necessary adage of references intact, we encountered this error:

"A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project"

What could be the solution to this? We foremost tried building the project without clicking F5 after creating a Windows app and changing the startup page, left with scant measures (i.e. double-checking the references if they are complete)to determine the best possible solution instantly.
Apr 2 '11 #1
0 1615

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bruce | last post by:
Hi: I was interested in installing AutoCAD 2005 on my computer with Win XP Pro. I went to the AutoCAD website, and it said something like "Windows XP Pro, and Service pak 2 are compatible with...
0
by: paii, Ron | last post by:
I have a table listing Part numbers and a full path to the Autocad drawing. I need a report that will print the drawing, Zoomed to a fixed sized window on the report. Has anyone done OLE with...
0
by: Kathy | last post by:
Hi and Thanks for you help! Several years ago I created a Product Specification db that displayed AutoCad 2000 drawings in a report (The Spec Sheet) Recently we upgraded our AutoCad to the 2004...
3
by: perspolis | last post by:
I want to open Autocad files from my application and edit them there like Insert object in word
4
by: ARF | last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting fatal compiler errors. I start with a default C++/CLR class library project and modify it by adding the following...
3
by: Aman | last post by:
hi, im trying to draw some rectangles,lines in autocad using c, is their any function that can be used, plz help, also is it possible to read values from a ms excel file in c
3
by: koliver | last post by:
Can anyone provide me with information on linking an Access database with GPS mapping software
3
by: shaiful | last post by:
Hi all, I have a problem with opening and closing AutoCAD in VB6 properly. I opened AutoCAD in VB by Dim AcadApp As Object, acadDoc As Object and close it by Set acadDoc = Nothing Set AcadApp...
1
by: dim505 | last post by:
Hi friends, I want to open an autocad file using C# program in asp.net and read the parameters of that .dwg file.I could able to open the .dwg file but dont know how to read the parameters like...
1
by: aaron knezevic | last post by:
I'm attempting to open an access file, form and go to a specific record from an autocad drawing. using excell and creating a macro I've gotten as far as to get the form open but can't get to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.