473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scuffle w AutoCAD programming using VB.NET (mainly)

1 New Member
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.AutoCA D.Runtime

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

Dim AcadApp As Autodesk.AutoCA D.Interop.AcadA pplication
Dim acaddoc As Autodesk.AutoCA D.Interop.AcadD ocument
Dim pt As Object
Dim pt1 As Object

AcadApp = GetObject(, "Autocad.Applic ation")
acaddoc = AcadApp.ActiveD ocument

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

acaddoc.ModelSp ace.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 1638

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

Similar topics

0
1915
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 AutoCAD 2005". So I thought that meant that Service pak 2 installed a .NET Framework for AutoCAD to work. I installed SP2, and AutoCAD still won't install correctly. My question is this: Are they 2 different animals?
0
1883
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 AutoCad and can point me in the right direction. I am using Access97 and Autocad 2000. So far I have tried an unbound object frame and the following in the onformat event. Me!.Class = "AutoCAD.Drawing" ' Set class name.
0
1375
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 version. Now, we can insert a drawing into a table and if we double click the drawing (an ole object)AutoCad will open and you can edit the drawing with no problem. However if you run a query including the drawing field and doubleclick the colum in...
3
2815
by: perspolis | last post by:
I want to open Autocad files from my application and edit them there like Insert object in word
4
5644
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 references: acdbmgd.dll acmgd.dll the entire source for the default library header file is:
3
2767
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
3809
by: koliver | last post by:
Can anyone provide me with information on linking an Access database with GPS mapping software
3
1835
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 = Nothing So, it opens and closes properly. I am opening many autoCAD files by using loop. In that time if I put more than about 30 times loop it says "memory out". In that case how can I solve this problem? I guess AutoCAD doesn't close properly,...
1
10549
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 length,height of wall,doors,window and number of windows etc. I opened the file by following code using AutoCAD; public static AcadApplication gbl_open; public static AcadApplication gbl_app; public static AcadDocument gbl_doc; ...
1
2168
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 specific record. can any 1 tell me how?
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.