acdbmgd.dll contains ObjectDBX/RealDWG managed types (everything to do with manipulating drawing files).
ObjectDBX is useful because you directly access the DWG file without adding the extra resources needed to actually show the drawing. This means that the performance is really good. All entities, objects based on AcadObject and dictionaries can be accessed.
You cannot have a freestanding application that uses ObjectDBX unless you have AutoCAD running. Either a DLL must be created that is loaded from within AutoCAD with the NETLOAD command or you need to use ActiveX to access or connect to ObjectDBX using the AcadApplication object and the GetInterfaceObject method.
ObjectDBX is actually renamed to RealDWG and if you need to use it without having AutoCAD you need to purchase and license it. RealDWG does not require the presence of AutoCAD software. RealDWG 2008 is the latest version available now.
Below is a sample that starts AutoCAD 2008 and opens a drawing with ObjectDBX.
Private Function StartAutoCAD() As Object On Error Resume Next Dim AcadApp As Object ' Get the active session of AutoCAD using late binding AcadApp = GetObject(, "AutoCAD.Application.17.1") If Err.Number <> 0 Then Err.Clear() Shell("c:\Program Files\Common Files\Autodesk Shared\WSCommCntr1.exe", AppWinStyle.NormalFocus) ' Create a new session of AutoCAD using late binding AcadApp = CreateObject("AutoCAD.Application.17.1") End If Return AcadApp End Function Private Sub Test() Dim AcadApp As Object Dim dbxDoc As Object AcadApp = StartAutoCAD() If AcadApp Then AcadApp.Visible = True objDbx = AcadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.17") objDbx.Open("D:\test\block1.dwg") Dim ms As Object ms = objDbx.ModelSpace MsgBox(ms.Count.ToString + " objects in in model space") objDbx = Nothing AcadApp.Application.Quit() AcadApp = Nothing End If End Sub
See also ObjectDBX sample using VBA and AutoCAD 2008 and Copy dimstyles between drawings using VBA for other posts how to use ObjectDBX.
Restored comment
ReplyDeleteby Barry
Great post.
Thx for the help.