我们公司的AUTOCAD是华中理工做二次开发的,其基本的功能归根结底也就是使繁杂的操作变成简单的步骤,还有实现中国的标准件库。或许你可以从华中理工那里找一找。
解决方案 »
- vb得到ipconfig执行后的结果
- 一个很急的问题,编译的exe不能到别的机器上执行
- 我的SendData函数是用VC写的,然后用VB引出来的dll文件。。在C++里面是这么写的BOOL __stdcall SendData(float fData[136][7],int nRow
- windows help designer怎么把project编译成chm文件
- 数据库中字段修改——如果要修改表中的某一个字段,使用怎样的代码实现,而不需要对表中的所有字段都进行修改?
- 菜单前的图片是怎么做的?还有按钮前的图标是怎么做的呢?急急急...菜单前的图片是怎么做的?还有按钮前的图标是怎么做的呢
- 本人有个关于注册表的问题??
- 菱形画法:根据角度画,填充、并且角度可变!能实现吗?要程序,多注释一点:)
- 谁解决此问题?送QQ号码
- 圣诞节的问题?
- 关于VB6.0中实现模糊查询的问题
- 怎样将某一文本文件的第1、3、5...行的内容按顺序填写到自己编写程序中的文本框、组合框中...
书在市面上很多
网站少见
To update the coding examples for use with VB, you must first reference the AutoCAD type library. To do this in VB, select the References option from the Project menu to launch the Reference dialog box. From the References dialog box, choose AutoCAD Release 15 Type Library and press OK.
Next, in the code example replace all references to ThisDrawing with a user-specified variable referencing the active document. To do this, define a variable for the AutoCAD application (acadApp) and for the current document
(acadDoc). Then, set the application variable to the current AutoCAD application.If AutoCAD is running, the GetObject method retrieves the AutoCAD Application object. If AutoCAD is not running, an error occurs that (in this example) is trapped, then cleared. The CreateObject method then attempts to create an AutoCAD Application object. If it succeeds, AutoCAD is started; if it fails, a message box displays a description of the error. The following code example uses the Clear and Description properties of Err. If your coding environment does not support these properties, you will need to modify the example appropriately:Connecting to AutoCAD from Visual BasicSub Ch2_ConnectToAcad()
Dim acadApp As AcadApplication
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
MsgBox "Now running " + acadApp.Name + _
" version " + acadApp.VersionEnd SubNext, set the document variable to the Document object in the AutoCAD application. The Document object is returned by the ActiveDocument property of the Application object. Dim acadDoc as AcadDocumentSet acadDoc = acadApp.ActiveDocumentFrom this point on, use the acadDoc variable to reference the current AutoCAD drawing.
NOTE When running multiple sessions of AutoCAD, the GetObject function will return the first instance of AutoCAD in the Windows Running Object Table. See the Microsoft Visual Basic documentation on the Running Object Table (ROT) and the GetObject function for more information on verifying the session returned by GetObject.VBA versus VB Comparison Code ExampleThe following code example demonstrates creating a line in both VBA and VB:Creating a line using VBASub Ch2_AddLineVBA()
' This example adds a line
' in model space
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' Define the start and end
' points for the line
startPoint(0) = 1
startPoint(1) = 1
startPoint(2) = 0
endPoint(0) = 5
endPoint(1) = 5
endPoint(2) = 0
' Create the line in model space
Set lineObj = ThisDrawing. _
ModelSpace.AddLine _ (startPoint, endPoint)
' Zoom in on the newly created line
ZoomAllEnd SubCreating a line using VBSub Ch2_AddLineVB()
On Error Resume Next
' Connect to the AutoCAD application
Dim acadApp As AcadApplication
Set acadApp = GetObject _
(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject _
("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' Connect to the AutoCAD drawing
Dim acadDoc As AcadDocument Set acadDoc = acadApp.ActiveDocument
' Establish the endpoints of the line
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
startPoint(0) = 1
startPoint(1) = 1
startPoint(2) = 0
endPoint(0) = 5
endPoint(1) = 5
endPoint(2) = 0
' Create a Line object in model space
Set lineObj = acadDoc.ModelSpace.AddLine _
(startPoint, endPoint)
ZoomAllEnd Sub