如何在iLogic里引用AutoCADCOMAPI
用户可以用AddReference来引用AutoCAD COM的程序集,下面我们来展示一下怎么做。
首先,iLogic 需要找到要引用的程序集。
iLogic去哪儿找引用的程序集,是由Tools→Options→iLogicConfiguration里面“iLogic Addins DLLs Directory”的设置来定的。
我们需要把Autodesk.AutoCAD.Interop.dll和Autodesk.AutoCAD.Interop.Common.dll 拷贝到 “iLogic AddIn Dlls Directory”指定的位置,如下图:
下面是引用了AutoCAD的程序集的iLogic规则示例。
它展示了AutoCAD COM API里的类型声明:AcadBlockReference 和 AcadCircle。它也展示了怎样得到和创建一个Autocad的会话对象。
AddReference "Autodesk.AutoCAD.Interop"AddReference "Autodesk.AutoCAD.Interop.Common"
Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AutoCAD.Interop
Sub Main
Dim oAcadApp As AcadApplication
oAcadApp = CreateObject("AutoCAD.Application")
'If AutoCAD is already running use GetObject
'oAcadApp = GetObject(,"AutoCAD.Application")
oAcadApp.Visible = True
Dim myBlockRef As AcadBlockReference
Dim oAcadCircl as AcadCircle
MessageBox.Show(oAcadApp.Caption, "Title")End Sub请点这里↓↓↓
首先,iLogic 需要找到要引用的程序集。
iLogic去哪儿找引用的程序集,是由Tools→Options→iLogicConfiguration里面“iLogic Addins DLLs Directory”的设置来定的。
我们需要把Autodesk.AutoCAD.Interop.dll和Autodesk.AutoCAD.Interop.Common.dll 拷贝到 “iLogic AddIn Dlls Directory”指定的位置,如下图:
下面是引用了AutoCAD的程序集的iLogic规则示例。
它展示了AutoCAD COM API里的类型声明:AcadBlockReference 和 AcadCircle。它也展示了怎样得到和创建一个Autocad的会话对象。
AddReference "Autodesk.AutoCAD.Interop"AddReference "Autodesk.AutoCAD.Interop.Common"
Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AutoCAD.Interop
Sub Main
Dim oAcadApp As AcadApplication
oAcadApp = CreateObject("AutoCAD.Application")
'If AutoCAD is already running use GetObject
'oAcadApp = GetObject(,"AutoCAD.Application")
oAcadApp.Visible = True
Dim myBlockRef As AcadBlockReference
Dim oAcadCircl as AcadCircle
MessageBox.Show(oAcadApp.Caption, "Title")End Sub请点这里↓↓↓