As more and more people are interested in AutoCAD Map 3D development technology, from this article, I will take a small project as an example, from design to implementation, record the development process of a Map 3D project step by step. If you are interested in AutoCAD Map 3D secondary development technology, join this project to study it. The project name is Map Resource Explorer. Now it has been published on Google Code as an open-source project. You can view its source Code and progress at any time. You and I are welcome to participate in development.
Background:
AutoCAD Map 3D is a geographic information platform software built on the basis of AutoCAD. It not only contains all the functions of AutoCAD, but also has a wide range of specialized tools and functions for the geographic information field. Map 3D uses the FDO (Feature Data Object) technology to directly access the vast majority of GIS Data formats (including SDF, SHP, MySQL, Oracle, and SQL Server Spatial) on the market, thus avoiding format conversion, data redundancy, multi-version maintenance, and so on.
The data connection information, layers, and so on exist in Map 3D based on the resource situation. They can be expressed in XML format. In the process of Map 3D development and debugging, we often need to check whether the XML of these resources is correct. But is there such a tool that allows us to conveniently view the resources in Map 3D. This is the original intention of the project design. The goal is to design a plug-in that can traverse the XML Representation of all Map 3D resources and their resources.
AutoCAD Map 3D is built based on AutoCAD, so relevant APIs of AutoCAD can run normally on Map 3D, while we perform secondary development on Map 3D, the AutoCAD.net API must also be used to create interfaces and other work; the Geospatial Platform API provided by Map 3D is a set based on.. net APIs are the same as MapGuide APIs for the usage of many method attributes. If you are familiar with MapGuide development, you can quickly start Map 3D development. And vice versa. After you have learned about the development of Map 3D through this project, MapGuide development will also be helpful.
Tool preparation:
To do well, you must first sharpen your tools. Prepare necessary tools before getting started.
1. AutoCAD Map 3D 2011 or Civil 3D 2011, this is inevitable, ADN users can download from the ADN website, non-ADN users can go to the Autodesk website to apply for a trial http://usa.autodesk.com/adsk/servlet/pc/index? SiteID = 123112 & id = 13842112
2. Visual Studio 2008 SP1
3. TortoriseSVN, I put the source code of this project on GoogleCode, if you are interested in learning together, you need TortoiseSVN (http://tortoisesvn.net/downloads ).
4 AnkhSVN, this tool can combine SVN and Visual Studio interface, version control is more convenient (http://ankhsvn.open.collab.net /).
Start work:
This tool runs as a plug-in for Map 3D. The first step is to create a Class Library project in Visual Studio:
Add references related to AutoCAD and Map 3D, and set the Copy Local attribute to False. The Assembly is under the installation directory of Map 3D:
AutoCAD. NET-related Assembly:
Acmgd. dll
Acdbmgd. dll
Map 3D related Assembly:
Autodesk. Map. Platform. dll
Autodesk. Map. Platform. Core. dll
Autodesk. Map. Platform. Utils. dll;
Autodesk. Gis. Map. Shared. dll;
OSGeo. MapGuide. Foundation. dll
OSGeo. MaoGuide. PlatformBase. dll
Delete the original Class1.cs and create a class named Command. cs, we will first write a simple CmdList command. This command is very simple, that is, print out the available commands on the command line:
using System;using System.Collections.Generic;using System.Linq;using System.Text; using Autodesk.AutoCAD.ApplicationServices;using Autodesk.AutoCAD.EditorInput;using Autodesk.AutoCAD.Runtime; using MapResourceExplorer.UI;using Autodesk.Gis.Map.Platform.Utils;using MapResourceExplorer.Model; namespace MapResourceExplorer{public class Commands{ [CommandMethod("CmdList")] public void CmdListCommand() { Util.PrintLn("PROMPT: MapResourceExplore commands:"); Util.PrintLn("\nResourceExplorer"); Util.PrintLn("\nRegisterEvents"); } }}
Now, let's first come here today. Next, let's talk about how to run and debug it.
Source code:
I have now written a part of the source Code uploaded to Google Code, http://code.google.com/p/map-resource-explorer/, if you are interested can download view. If you are interested in learning together, you can write to me and tell me your gmail account. Send the email to duchangyu # gmail.com (# Replace @)
Cheers,
Junqilian