<?xml encoding=”UTF-8″>By Wayne Brill
You can use AddReference to reference the AutoCAD COM Interops. Below is an iLogic rule to test this. (It just Dims a couple of types) iLogic needs to be able to find the AutoCAD Interop dlls. The path where it looks for the interop dlls is set in the Advanced iLogic Configuration. (tools tab Options). You can copy Autodesk.AutoCAD.Interop.dll and Autodesk.AutoCAD.Interop.Common.dll to the “iLogic AddIn DLLs directory” to avoid the error with the AddReference line of code. This screenshot shows the path where iLogic will look for the interop DLLs.
Here is the iLogic rule that references the AutoCAD Interops. It shows declaring types from the AutoCAD COM API. AcadBlockReference and AcadCircle. It also creates or gets a running session of 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


Leave a Reply to MaxU77Cancel reply