Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

.NET external application - Workflow automation - Search and replace DWG


I'm doing a bit of workflow automation. I want to use the BricsCad interop to search and replace text in a dwg file. I want it to be an external application as I'm populating directories and other file types (Excel, word templates)

My application targes .Net 5.0

I've add references to BrxMgd.DLL and TD_Mgd.DLL (local copy = false). Separate class library to the winforms app.

However, as soon as I hit Execute(). I get a 'file not found exception. BrxMgd.DLL can't be found?

Any help or Code snippest would be appreciated.

using AcRx = Bricscad.Runtime;
using AcTrx = Teigha.Runtime;
using AcAp = Bricscad.ApplicationServices;
using AcDb = Teigha.DatabaseServices;
using AcGe = Teigha.Geometry;
using AcEd = Bricscad.EditorInput;
using AcGi = Teigha.GraphicsInterface;
using AcClr = Teigha.Colors;
using AcWnd = Bricscad.Windows;
using AcApP = Bricscad.ApplicationServices.Application;

        public override bool Execute()
            AcAp.Document doc = AcApP.DocumentManager.MdiActiveDocument;
            AcEd.Editor ed = doc.Editor;
            AcDb.Database destDb = doc.Database;

                // Create a source database to load the DWG into
                using (AcDb.Database db = new AcDb.Database(false, true))
                    // Read the DWG into our side database
                    db.ReadDwgFile(templateFile, AcDb.FileOpenMode.OpenForReadAndAllShare, false, string.Empty);
                    AcDb.Transaction tr = db.TransactionManager.StartTransaction();
                    using (tr)
                        //// DO SEARCH AND REPLACE HERE

                        AcDb.DBObjectCollection obs = tr.GetAllObjects();
                        foreach (AcDb.DBObject ob in obs)
                            AcDb.MText mt = ob as AcDb.MText;

                            if (mt != null)



            catch (System.Exception e)

                Console.Out.WriteLine( + "caused and error, skipping");
Sign In or Register to comment.
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam