Message 1 of 6
Fatal Error Trying to Run Add-In
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have an Add-in, which I call from a COM application, but have added CommandMethods to for testing. When I try to run the CommandMethod within AutoCAD - I get an immediate fatal error. I'm not able to capture any kind of error other than this:
I'm running AutoCAD2016, and Visusal Studio2013.
Here is my Add-In code - any suggestions as to what I'm doing wrong?
namespace HM.ACAD_Add_In { [Guid("704E842F-0CA5-4360-A932-C45186AE23AE"), ComVisible(true)] public interface IAttribAdd { [DispId(1)] string AddAttribs(string fileToOpen, string DWGSaveName, string[] layerInfo, string[] attDefInfo); string ModAttribs(string fileToOpen, string DWGSaveName, string[] layerInfo, string[] attDefInfo); } [ProgId("Attribute.Commands"), Guid("D1B6C2D5-E815-4E2A-B4B7-BDA7C0BA81FD"), ClassInterface(ClassInterfaceType.None)] public class Commands : ServicedComponent, IAttribAdd { [CommandMethod("INFORTEST")] public void InforTest() // This method can have any name { Document doc = Application.DocumentManager.MdiActiveDocument; if (doc != null) { Editor ed = doc.Editor; ed.WriteMessage("\nInfor.AttribAdd is loaded."); } } [CommandMethod("ACISIN_TEST")] public void acisin_test() // This method can have any name { OpenACIS(@"C:\BookCase24x16x68.SAT"); } [CommandMethod("ADDLAYERS_TEST")] public void addlayers_test() { Document doc = Application.DocumentManager.MdiActiveDocument; Database acDb = doc.Database; Editor ed = doc.Editor; string[] stringLayers = {"STORAGE", "MAGENTA", "STORAGE-CAPPN", "WHITE", "STORAGE-CAPPD", "WHITE", "STORAGE-CAPMG", "WHITE", "STORAGE-CAPMC", "WHITE"}; //AddLayers(stringLayers, doc, acDb); } [CommandMethod("ADDATTRBS_TEST")] public void addattrbs_test() { Document doc = Application.DocumentManager.MdiActiveDocument; Database acDb = doc.Database; Editor ed = doc.Editor; string message = "None"; string[] stringAttrbs = {"CAPPN", "PartNumber", "", "True", "False", "False", "False", "True", "False", "5,-5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPPN", "WHITE", "CAPPD", "PartDescription", "", "True", "False", "False", "False", "True", "False", "5,-7.5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPPD", "WHITE", "CAPMG", "ManufacturingCode", "", "True", "False", "False", "False", "True", "False", "5,-10,0", "2", "BottomLeft", "Arial", "STORAGE-CAPMG", "WHITE", "CAPMC", "CatalogCode", "", "True", "False", "False", "False", "True", "False", "5,-12.5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPMC", "WHITE"}; message = AddAttributeDefs(stringAttrbs); ed.WriteMessage("\n" + message); } [CommandMethod("V_NET")] public void V_Net() { VPointNetClass VP = new VPointNetClass(); VP.VPointNet(225, 35); } [CommandMethod("ZOOM_TEST")] public void zoom_test() { //Zoom(new Point3d(), new Point3d(), new Point3d(), 1.01075); Zoom(new Point3d(265.1, -404.7, 1579.0), new Point3d(838.0, 168.2, 1006.2), new Point3d(0.4, 0.4, 0.8), 1); } [CommandMethod("ModAttribs_Test")] public void modattribs_test() { TextWriterTraceListener tr1 = new TextWriterTraceListener(System.IO.File.CreateText("C:\\Output.txt")); Debug.Listeners.Add(tr1); tr1.WriteLine("Inside ModAttribs_Test"); Document doc = Application.DocumentManager.MdiActiveDocument; tr1.WriteLine("Got active document."); Database acDb = doc.Database; tr1.WriteLine("Got current database inside active document."); Editor ed = doc.Editor; tr1.WriteLine("Set editor to current document editor."); string message = "None"; string dwgToProcess = "C:\\TDCI2D\\HermanMiller\\PhaseII\\554091T.DWG"; string dwgToSave = "C:\\TDCI2D\\HermanMiller\\PhaseII\\554091T_.DWG"; string[] lyrs = {"Test", "WHITE"}; string[] stringAttrbs = {"CAPPN", "PartNumber", "", "True", "False", "False", "False", "True", "False", "5,-5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPPN", "WHITE", "CAPPD", "PartDescription", "", "True", "False", "False", "False", "True", "False", "5,-7.5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPPD", "WHITE", "CAPMG", "ManufacturingCode", "", "True", "False", "False", "False", "True", "False", "5,-10,0", "2", "BottomLeft", "Arial", "STORAGE-CAPMG", "WHITE", "CAPMC", "CatalogCode", "", "True", "False", "False", "False", "True", "False", "5,-12.5,0", "2", "BottomLeft", "Arial", "STORAGE-CAPMC", "WHITE"}; tr1.WriteLine("set dwgToProcess, dwgToSave, lyrs, and stringAttribs"); tr1.WriteLine("Calling Mod_Attribs."); message = ModAttribs(dwgToProcess, dwgToSave, lyrs, stringAttrbs); ed.WriteMessage("\n" + message); tr1.Flush(); }