Jump to content

Search the Community

Showing results for tags 'c-sharp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. btraemoore

    Fatal reading error...

    I'm accessing autocad via COM and netloading a custom dll, but when i call my start function inside of my dll, intermittently i get a fatal error.. I do not get it when i call the method from in process, but only when i call it from COM. Here is the code from when get a list of paths. private void Btn_ContClick(object sender, System.EventArgs e) { List<string> DwgList = getDWGStofix(); sendToExecute(DwgList,"faud"); } bool SC = true; private void sendToExecute(List<string> DwgList,string cmd){ PreloadCmds(); if (DwgList != null) { foreach (string pth in DwgList) { if(SC) FixDwg(pth,cmd); else break; } if(AcApp != null) AcApp.Quit(); if(SC) MessageBox.Show("Successful completion!!","ALERT"); Application.Exit(); } } AcadDocument activeDWG; private void PreloadCmds(){ string NewDWGPth = "C:/Documents and Settings/moorerb/application data/autodesk/autocad 2012 - english/r18.2/enu/template/acad.dwt"; try { activeDWG = AcApp.ActiveDocument; } catch (Exception) { AcApp.Documents.Open(NewDWGPth,false); activeDWG = AcApp.ActiveDocument; } activeDWG.SendCommand( string.Format( "(command \"netload\" \"{0}InProcAudit.dll\")\n",dllPath.Replace('\\','/')) ); } string prevDWG; private void FixDwg(string pth, string cmd) { activeDWG = AcApp.Documents.Open(pth,false); activeDWG.SetVariable("USERI1",1); if(prevDWG != null) activeDWG.SetVariable("USERS1",prevDWG); // try to send the the activation command to the active drawing command line. try { var*appState*=*AcApp.GetAcadState(); while*(!appState.IsQuiescent){} activeDWG.SendCommand(string.Format("{0}\n",cmd)); } catch (System.Exception ex) { if(ex.Message.Contains("The remote procedure call failed.")){ MessageBox.Show( string.Format( "We have encountered an error with drawing \"{0}\".",pth) ,"Error" ,MessageBoxButtons.OK ,MessageBoxIcon.Exclamation ); AcApp = null; SC = false; } } activeDWG.BeginClose += new _DAcadDocumentEvents_BeginCloseEventHandler(activeDWG_BeginClose); while (activeDWG.GetVariable("USERI1") == 1) { try { // hold for .5 seconds before checking for variable change Thread.Sleep(500); } catch (COMException CE) { if(CE.ErrorCode.ToString() == "-2147417848"){ activeDWG.BeginClose -= new _DAcadDocumentEvents_BeginCloseEventHandler(activeDWG_BeginClose); activeDWG = null; break; } } } prevDWG = pth; activeDWG.Save(); if(activeDWG != null) activeDWG.Close(); } I've been trying to figure it out for a few days now and cant seem to fix the problem.. My analysis is that im interupting autocad, to counter that i put an AcadState.isQuiescent() check in there.. any ideas?
×
×
  • Create New...