Skip to content

tpenninger/cad-map-dotnet

Repository files navigation

cad-map-dotnet

A tool to capture Block entity data from DWG files using the AutoCAD .NET API.

Installation

Using the NETLOAD command, import the cad-map-dotnet.dll from cad-map-dotnet/bin. You'll need a SQL database formatted appropriately to store the information (see below).

Setting up the SQL Database

Download SQL Server Express and follow the instructions to set it up using your computer's name as the local host. You can find your computer name on Windows by searching for "System Information" and then looking at "System Name". Then, create a database with default settings and the name CADDB to create a database, as well as the remaining CreateTable_*.sql to generate the remaining tables inside the database.

Build and use CAD-MAP in AutoCAD

  1. Install the software requirements found at this page: My First AutoCAD Plug-In Overview. Specifically, you'll need Visual Studio 2019 not 2022. Make sure to scroll all the way to the bottom of the page to find the AutoCAD and ObjectARX .NET wizards.

  2. After installing the ObjectARX SDK, and the ObjectARX/.NET wizards, import the following References (Project -> Add Reference...) into Visual Studio: accoremgd.dll, acdbmgd.dll, and acmgd.dll and set their "Copy Local" status to False. On a default C drive-based Windows installation, you'll find these in C:\Autodesk\ObjectARX_for_AutoCAD_2023_Win_64bit_dlm\inc.

  3. Change the connstr value in Settings1.settings to point at the path of your database. If you're using a non-trusted connection, or any other type of connection, reference the SQL server connection string types at this link.

  4. Finally, build the project by running it using the Build command (Ctrl+Shift+B by default). You'll find the compiled .dll in cad-map-dotnet\bin\debug as cad-map-dotnet.dll. Load this in AutoCAD using the NETLOAD command, then run CAD-MAP by running the CADMAP command.

Allowing network-loaded files

Depending on your network and local PC security settings, you may the following errors:

  1. In Visual Studio, when attempting to build the .dll: Couldn’t process file mainForm.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files. Solution: open Main.resx in file explorer and select the option to "Unblock" where it says "Security: This file came from another computer and might be blocked to help protect this computer." You can find more information about this error here.

  2. In AutoCAD, after calling NETLOAD: System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch.: In your AutoCAD installation folder, you can find acad.exe.config. Open this in a text editor and add the following flag between the <runtime> and </runtime> elements: <loadFromRemoteSources enabled="true"/>. You can find more information about this error here.

About

A tool to capture Block entity data from DWG files using the AutoCAD .NET API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors