Gooner_4692 Posted February 27 Share Posted February 27 (edited) Hi everyone, I'm relatively new to VB and AutoCAD, and I've been trying to incorporate a command line method into my existing code to copy, move, and scale a drawing. However, I've hit a roadblock and would appreciate some guidance. Every time I try to run the code, I encounter an error stating "acdbmgd.dll not found." From what I understand, this seems to be related to a missing reference or dependency associated with AutoCAD libraries. Here's the code I've been working on: Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.EditorInput Public Class SelectionSetClass <CommandMethod("SelectWindowAndCopy")> Public Sub SelectWindowAndCopy() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim edt As Editor = doc.Editor Using trans As Transaction = doc.TransactionManager.StartTransaction() Dim psr As PromptSelectionResult = edt.SelectWindow(New Point3d(36, 22, 0), New Point3d(149.5, 33, 0)) If psr.Status = PromptStatus.OK Then Dim ss As SelectionSet = psr.Value ' Get the bottom-left corner of the window selection Dim windowBottomLeft As Point3d = New Point3d(35, 22, 0) For Each sobj As SelectedObject In ss Dim ent As Entity = TryCast(trans.GetObject(sobj.ObjectId, OpenMode.ForWrite), Entity) If Not ent Is Nothing Then '' Create a copy of the selected entity Dim entCopy As Entity = ent.Clone() ' Create a copy of the entity '' Calculate the translation vector to move the bottom-left corner of the entity to the origin Dim translationVector As Vector3d = New Vector3d(-windowBottomLeft.X, -windowBottomLeft.Y, 0) '' Apply the translation transformation entCopy.TransformBy(Matrix3d.Displacement(translationVector)) '' Apply the scaling transformation Dim scaleMatrix As Matrix3d = Matrix3d.Scaling(10, New Point3d(0, 0, 0)) entCopy.TransformBy(scaleMatrix) '' Open the Block table for write Dim acBlkTbl As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead) Dim acBlkTblRec As BlockTableRecord = trans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) '' Add the copied entity to the block table record acBlkTblRec.AppendEntity(entCopy) trans.AddNewlyCreatedDBObject(entCopy, True) End If Next End If trans.Commit() End Using End Sub End Class I've tried researching this issue online, but I'm still unsure how to resolve it. Can anyone please provide insights on how I can properly reference the required AutoCAD libraries in my project settings to fix this error? Any help or suggestions would be greatly appreciated. Thank you in advance! Edited February 27 by SLW210 Code Tags! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 27 Share Posted February 27 Please use Code Tags in the future. (<> in the editor toolbar) Quote Link to comment Share on other sites More sharing options...
CyberAngel Posted March 4 Share Posted March 4 acdbmgd.dll is associated with the DatabaseServices library. It's kind of important, because a drawing is basically a database full of objects. See this discussion. If you're creating an EXE, you can't use .NET, if I'm reading it correctly. There is some good advice on how to work with VBA. If that doesn't take care of your issue, please provide more information. Welcome to the forum! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted March 4 Share Posted March 4 Perhaps this discussion as well. Quote From taking programming classes led by some of the head developers from Autodesk they said to always reference the acmgd & acdbmgd dlls from the ObjectARX sdk (not the one delivered with the software) and to NOT deliver them with your own applications. Quote Link to comment Share on other sites More sharing options...
Gooner_4692 Posted March 5 Author Share Posted March 5 Yeah I was creating an .exe file, it can't be used. I went ahead with sendcommand , was able to do all the three operations. https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-E13A580D-04CA-46C1-B807-95BB461A0A57 Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.