autocad.net二次开发中visualstudio版本问题

Overview of Microsoft Visual Studio

Microsoft Visual Studio概述

Microsoft Visual Studio is an object-oriented programming environment that runs independently of AutoCAD. While Microsoft Visual Studio is external to AutoCAD and other applications, it is able to interact with applications that expose either a native .NET API or ActiveX/COM library.

Microsoft Visual Studio是不依赖AutoCAD运行的面向对象编程环境。虽然Microsoft Visual Studio是AutoCAD及其他应用程序的外部环境,但它能与那些公开了自己的本地.NET API或ActiveX/COM库的应用程序进行交互。

Topics in this section本节主题

·         Which Edition of Microsoft Visual Studio to Use 使用Visual Studio哪个版本

·         Use COM Interoperability with .NET 使用COM与.NET交互操作

·         Dependencies and Restrictions 依赖性及限制

 

1、Which Edition of Microsoft Visual Studio to Use使用Visual Studio哪个版本

Microsoft Visual Studio is available in multiple versions and editions. To use the .NET API for AutoCAD 2012, you need to use:

Microsoft Visual Studio有多个版本可用。要是开发AutoCAD 2012 .NET API项目,我们需要使用:

·         Microsoft Visual Studio 2010

·         Microsoft .NET Framework 4.0

Note Projects compiled with Microsoft Visual Studio 2008 with a target of Microsoft .NET Framework 3.5 should load into AutoCAD 2012 without a problem. Microsoft Visual Studio 2008 cannot be used to debug projects loaded in AutoCAD 2012; you must use Microsoft Visual Studio 2010 when debugging a project.

注意:由Microsoft Visual Studio 2008编译的目标为Microsoft .NET Framework 3.5的项目可以加载到AutoCAD2012运行没有问题。但Microsoft Visual Studio 2008不能用来调试AutoCAD 2012加载的项目,调试项目时必须使用Microsoft Visual Studio 2010。

If you are using AutoCAD 2010 or AutoCAD 2011, you should use:

如果使用的是AutoCAD 2010或AutoCAD 2011,则应选择:

·         Microsoft Visual Studio 2008 with Service Pack 1

·         Microsoft .NET Framework 3.5 with Service Pack 1

If you are using AutoCAD 2007 through AutoCAD 2009, you should use:

如果使用的是AutoCAD 2007到AutoCAD 2009,则应选择:

·         Microsoft Visual Studio 2005

·         Microsoft .NET Framework 2.0 or later (或2.0以上)

Microsoft Visual Studio is offered in two editions: for free and for pay. The free edition is known as Microsoft Visual Studio 2010 Express Edition, while the for pay editions vary by name and price due to the different development tools that are incorporated into them. Microsoft Visual Studio 2010 Professional Edition provides improved debugging over Microsoft Visual Studio 2010 Express Edition along with a number of other features. The most common edition of Microsoft Visual Studio used by developers is Microsoft Visual Studio 2010 Professional Edition.

Microsoft Visual Studio有两种版本供选择:免费版本和付费版本。免费版本众所周知就是Microsoft Visual Studio 2010 Express版,付费版本的名称和价格因整合的开发工具的不同而异。Microsoft Visual Studio 2010专业版提供了比Microsoft Visual Studio 2010 Express版改进了的调试性能及其他许多特性。开发人员最常用的Microsoft Visual Studio版本就是Microsoft Visual Studio 2010专业版。

Note While it is possible to use Microsoft Visual Studio Express with the AutoCAD .NET API, this guide assumes you are using one of the other versions such as Microsoft Visual Studio 2010 Professional Edition or Microsoft Visual Studio 2010 Premium Edition.

注意:可能有人使用Microsoft Visual Studio Express版进行AutoCAD .NET API开发,但本指南假设你使用的是Microsoft Visual Studio 2010专业版或Microsoft Visual Studio 2010高级版。

There are four main advantages to using Microsoft Visual Studio:

使用Microsoft Visual Studio的四大优势:

·         Robust and accessible development environment that has a modest learning curve. 强大易用的开发环境,轻松的学习过程;

·         VBA and VB.NET syntax are similar, which makes it an ideal environment for existing VBA users. VBA和VB.NET语法相近,是现有VBA开发人员理想的环境;

·         Visually intuitive and extensive dialog box creation tools. 直观、丰富的对话框创建工具;

·         Projects can be built as a standalone executable or DLL assembly which can then be loaded into AutoCAD for execution. 可以将项目生成为独立的可执行程序或DLL程序集,加载到AutoCAD执行;

Note Unlike VBA projects, .NET applications do not suffer from performance degradation when loaded and run in 64-bit AutoCAD.

注意:不像VBA项目,.NET应用程序加载并运行在64位AutoCAD环境时性能不会下降。

For more information on the different editions of Microsoft Visual Studio, see http://www.microsoft.com/vstudio and http://www.microsoft.com/express.

更多关于Microsoft Visual Studio不同版本的信息,见http://www.microsoft.com/vstudiohttp://www.microsoft.com/express。Please send us your comments about this page

2、Use COM Interoperability with .NET使用COM与.NET互操作

Microsoft Visual Studio can utilize both native .NET and COM interfaces in the same project. By utilizing COM interop, you can migrate existing code that might have been written in Visual Basic 6 or VBA without having to completely rewrite it. To access AutoCAD automation objects from a project created in Microsoft Visual Studio, create references to the following files:

Microsoft Visual Studio可以在同一个项目中使用本地.NET和COM两种接口,这样我们就可以移植现有的那些用VB6或VBA写的代码而不必完全重写。要想在Microsoft Visual Studio创建的项目中访问AutoCAD自动化对象,需要建立对下列文件的引用:

·         The AutoCAD 2012 type library, acax18enu.tlb, located at <drive>:\Program Files\Common Files\Autodesk Shared. AutoCAD 2012类库文件acax18enu.tlb,位于C:\ Program Files\Common Files\Autodesk Shared

·         The AutoCAD/ObjectDBX Common 18.0 type library, axdb18enu.tlb, located at <drive>:\Program Files\Common Files\Autodesk Shared. AutoCAD/ObjectDBX18.0通用类库文件axdb18enu.tlb,位于C:\ Program Files\Common Files\Autodesk Shared

Note The previous mentioned type libraries are also available as part of the ObjectARX SDK. For information on downloading and installing the ObjectARX SDK, see Components of the AutoCAD .NET API.

注意:前面提到的类库文件还可以从ObjectARX SDK中得到。……

These references will make the following primary interop assemblies available:

对这些类库的引用使得下列基本互操作程序集可用:

·         Autodesk.AutoCAD.Interop.dll (for AutoCAD-specific typesAutoCAD专有类型)

·         Autodesk.AutoCAD.Interop.Common.dll (for types shared by ObjectDBX host applications ObjectDBX宿主应用程序共享类型)

The interop assemblies are located in the global assembly cache; they map automation objects to their .NET counterparts.

互操作程序集位于全局程序集缓存;他们将自动化对象映射为.NET的对等对象。

After you reference the type libraries, you can declare AutoCAD-based variables in Microsoft Visual Studio, as in the following examples:

引用了这些类库,我们就可以在Microsoft Visual Studio中声明AutoCAD变量,像下面的例子:

VB.NET

Dim objAcApp As Autodesk.AutoCAD.Interop.AcadApplication

Dim objLine As Autodesk.AutoCAD.Interop.Common.AcadLine

C#

Autodesk.AutoCAD.Interop.AcadApplication objAcApp;

Autodesk.AutoCAD.Interop.Common.AcadLine objLine;

Utilizing the interop assemblies can make the transitioning your VBA projects over to VB.NET much easier. However, in order to take full advantage of everything that .NET and the AutoCAD .NET API have to offer, you will need to rewrite your existing VBA code.

应用互操作程序集使得将VBA项目转换为VB.NET项目更容易。不过,为了充分利用.NET和AutoCAD .NET API提供的全部功能,还是要重写现有VBA代码。

Create and Reference the AutoCAD Application 创建并引用AutoCAD应用程序

AutoCAD 2012 .NET applications can utilize the same type library (acax18enu.tlb) as AutoCAD automation projects. The type library is located in <drive>:\Program Files\Common Files\Autodesk Shared.

AutoCAD 2012 .NET应用程序可以和AutoCAD自动化项目一样利用相同的类库(acax18enu.tlb)。该类库位于c:\Program Files\Common Files\Autodesk Shared

AutoCAD 2012 .NET applications also use the same version-dependent ProgID for the CreateObject, GetObject, and GetInterfaceObject functions. For example, CreateObject ("AutoCAD.Application.18") allows you to create an instance of AutoCAD and get an object that represents the new instance of the application.

AutoCAD 2012 .NET应用程序的CreateObject、GetObject和GetInterfaceObject函数也使用同样的依赖版本的ProgID值。例如,CreateObject("AutoCAD.Application.18")允许我们创建一个AutoCAD的实例,并获取代表应用程序新示例的对象。

 

3、Dependencies and Restrictions依赖性及限制

Unlike ActiveX Automation, there are fewer issues with library conflicts when other applications are installed, reinstalled, or uninstalled. The reason for fewer compatibility issues is that the .NET Framework is a standardized platform. However, you can still run into dependency issues. To avoid dependency issues with the .NET Framework, be sure to use the same or an earlier version of the .NET Framework with your VB.NET or C# project that AutoCAD 2012 uses. For information on which version of the .NET Framework you should be referencing, see Which Edition of Microsoft Visual Studio to Use.

不像ActiveX Automation,在其他程序安装、重装及卸载时很少出现库冲突的情形。很少出现兼容问题的原因在于.NET Framework是一个标准化的平台。不过,还是会遇到依赖性问题。要避免.NET Framework依赖性问题,应确保使用与AutoCAD2012所用.NET Framework相同或更早的版本来开发VB.NET或C#项目。更多信息见使用Microsoft Visual Studio哪个版本。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: AutoCAD.NET是一种在AutoCAD平台上进行二次开发的工具,它允许开发者使用.NET编程语言(比如C#、VB.NET等)来创建自定义的功能和工具。 深入浅出AutoCAD.NET二次开发源码,意味着通过研究和理解AutoCAD.NET二次开发的源码,来掌握如何使用AutoCAD.NET来进行二次开发。 在开始深入研究源码之前,我们需要了解一些基础知识。首先,我们需要掌握AutoCAD的基本概念和操作方法,包括如何启动和关闭AutoCAD、如何创建新的绘图、如何绘制、编辑和修改图形等等。其次,我们需要掌握.NET编程语言,并熟悉Visual Studio这样的开发环境。 一旦我们具备了这些基础知识,我们可以开始研究AutoCAD.NET二次开发源码。源码通常会包含一些示例代码,我们可以通过阅读这些示例代码来理解AutoCAD.NET的主要功能和使用方法。同时,我们还可以通过分析源码的结构和逻辑,来学习AutoCAD.NET的工作原理和内部机制。 通过深入浅出的学习源码,我们可以逐步掌握AutoCAD.NET二次开发技术。我们可以根据自己的需求来扩展和定制AutoCAD的功能,比如创建自定义的命令、添加新的工具栏和菜单、实现特定的绘图算法等等。此外,通过阅读源码,我们还可以学习到一些编程技巧和最佳实践,从而加强我们的编程能力。 总之,深入浅出AutoCAD.NET二次开发源码是一项挑战和学习的过程,但通过不断研究和实践,我们可以逐渐掌握AutoCAD.NET二次开发技术,并应用于实际的项目。这将为我们提供更多的自定义功能和灵活性,帮助我们更好地完成各种AutoCAD相关的任务。 ### 回答2: autocad.net是一个用于二次开发自动CAD软件的编程接口。为了深入理解和掌握autocad.net二次开发源码,首先需要了解一些基础知识。 autocad.net是建立在.NET开发平台上的,因此需要具备良好的C#编程能力。熟悉C#的语法和特性将有助于我们更好地理解autocad.net源码的实现原理和细节。 在进行autocad.net二次开发时,我们可以通过查阅官方文档和示例代码来学习和理解源码。官方文档通常提供了对各种对象和方法的详细解释,示例代码将具体演示了如何使用这些对象和方法进行二次开发。 接下来,我们需要了解autocad.net的开发框架和主要功能模块。了解这些模块的作用和相互之间的关系,可以帮助我们更好地理解和分析源码。 在深入浅出autocad.net二次开发源码的过程,我们需要进行代码分析和调试。通过阅读源码,我们可以了解autocad.net在底层如何实现不同功能,理解其代码逻辑和设计思路。 在理解源码的基础上,我们可以根据自己的需求进行二次开发。这意味着我们可以根据具体的业务场景和需求,对源码进行修改和定制,以满足我们的开发目标。 总之,想要深入浅出地理解autocad.net二次开发源码,我们需要具备一定的C#编程能力,并且通过学习官方文档和示例代码来掌握autocad.net的基础知识。通过代码分析和调试,我们可以更深入地了解其实现细节。最后,根据自己的需求进行二次开发,加深对源码的理解和掌握。 ### 回答3: autocad.net是一种用于二次开发AutoCAD软件的编程语言和框架。它基于.NET平台,并提供了一系列的接口和类库,用于访问和操作AutoCAD软件的各种功能和对象。 深入浅出autocad.net二次开发源码意味着我们需要透彻理解和熟悉autocad.net的编程原理和方法,以便能够根据自己的需求进行二次开发。下面是一些源码的相关内容,帮助我们理解和学习autocad.net二次开发。 1. 类和对象:源码包含了一些核心类和对象的定义,如Application、Document、Layer、Block等。了解这些类和对象的属性、方法和事件,可以帮助我们在二次开发正确地操作和管理AutoCAD软件的各种元素。 2. 命令和交互:源码包含了一些处理命令和交互的代码,例如注册命令、响应用户输入等。学习这些代码可以让我们实现自定义的命令和用户交互界面,提高程序的灵活性和易用性。 3. 绘图和编辑:源码包含了一些绘图和编辑功能的实现,例如绘制线段、插入块等。通过学习这些代码,我们可以了解和掌握自定义绘图和编辑功能的实现方法。 4. 数据处理:源码包含了一些数据处理的代码,例如读取和操作AutoCAD的图形数据。学习这些代码可以帮助我们实现一些智能化的数据处理功能,例如自动计算、分析等。 5. 错误处理:源码还包含了一些错误处理的代码,例如异常捕获和处理。学习这些代码可以帮助我们编写健壮的程序,提高程序的可靠性和稳定性。 通过深入浅出地学习和理解这些源码,我们可以更好地掌握autocad.net二次开发的技巧和方法,从而能够根据自己的需求进行自定义开发,提高AutoCAD软件的功能和效率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值