One More Time Around the Block
In a previous post I discussed some of the reasons I may want to continue to use block attributes as a means to attribute point feature in AutoCAD even when using the Mapping Specification for Drawings to create data for use in ArcGIS.
Here is a new AutoLISP Routine that will build the MSD feature class schema in a drawing based on all of the block definitions and attributes on those block definitions that are contained in a drawing. The included AutoLISP command is called esri_BlockToFC. This tool is useful to generate new MSD feature classes and attributes when moving away from relying on AutoCAD block attributes as a means to store attributes in an AutoCAD file on Point, Line or Polygon entities. It will use the tag name of attributes and generate typed fields according to the any default value you may have specified for a particular ATTDEF. If the default value for the ATTDEF called diameter has a default value of 4.5 then this lisp routine will create an MSD feature class attribute with a floating type attribute. I can override the type of a field using the feature class management panel of ArcGIS for AutoCAD.
The MSD feature class filter criteria created for each feature class will be based solely on the block name from each block. I generally do not need different feature classes for every block in my drawing. I will likely need to use the ArcGIS for AutoCAD feature class management panel to rename feature classes and consolidate blocks, or remove or re-define the filtering criteria for the feature classes that get created. In the case where I might have blocks holding attributes for lines or polygons I will change the feature class type and the filtering criteria. I can use these tools to automate the process of copying attribute schema from my existing block attribute-based data creation workflows to take advantage of the MSD capabilities of ArcGIS for AutoCAD and ArcGIS Desktop. If nothing else it is an example of customizing the ArcGIS for AutoCAD application in a useful way with AutoLISP.