Archive for VBA

Debugging Civil 3D .NET Errors

Posted in Civil 3D with tags , , , , , on November 22, 2013 by Kyle Nishioka

I’ve reinstalled Infrastructure Design Suite Premium 2014 (IDSP) three times now since it came out in April. Civil 3D had become so unstable that it would only run for about 10 minutes before getting an error message like the one below.

Civil 3D .NET Error

Civil 3D .NET error message “The root Visual of a VisualTarget cannot have a parent.”

What that really means is that Civil 3D tripped up on some kind of .NET app/script and the Microsoft .NET error handler also failed to handle the error. I think I’ve narrowed the source of the problem to the conversion of VBA scripts to .NET. I remember opening a DWG that had some kind of VBA script which Civil 3D asked to automatically convert to .NET. I clicked “OK” and let the conversion run. The first hints of instability started a day or so after the conversion. I’m guessing that the conversion didn’t go so seamlessly and the fallout is corrupting something within Civil 3D or the .NET installation.

The only way I’ve been able to fix this is to:

  1. Do a clean uninstall of IDSP and uninstalling Microsoft .NET 4.5. The built-in Uninstall tool included in IDSP does an OK job of removing the main components of the suite, but there are always remnants of the Suite left over.
  2. Do a manual check to make sure you’ve uninstalled all Autodesk software. Go through the Windows Programs and Features list. Sort by Publisher and look for everything from Autodesk and remove those manually. There are even more leftover files and the only way to be sure you’ve deleted everything is to go through this checklist to uninstalling all Autodesk products.
  3. Once all Autodesk products are gone and .NET is uninstalled, do a reboot and reinstall .NET 4.5 from Microsoft directly. Then do a Windows update to patch .NET 4.5.
  4. After the reboot for the patch, reinstall IDSP.
  5. Patch the various IDSP components (Civil 3D, AutoCAD, MAP 3D, etc.) and then install the VBA module for AutoCAD. Ever since the AutoCAD 2010 release cycle, Autodesk has discontinued bundling the VBA modules in AutoCAD. But, you can still install the module separately.

I just found that last step about a week or so ago. I am hoping that installing the VBA module will prevent any accidental conversion of VBA scripTs to .NET. If it doesn’t Civil 3D will still prompt you to do the conversion if it encounters a VBA script in a DWG. I recommend never converting them to .NET.