Creating ODCLASS object definition files

Object definition files are the basis of ODCLASS workflow, these are the files defining the composition of drawing/modeling objects and descriptive characteristics of the objects. Object definition files can be created by any users for any drawing/modeling subject.

Object definition files are designed to be loaded into ODCLASS, and allow drawing/modeling with the described object types, defining existing graphical elements, selecting graphical elements defined, restoring graphical properties of the elements, checking the correctness of graphical properties and characteristic values.

 

ODCLASS, Version 1.19.2

Alexander Sharov ©   Russia, Moscow

odxclass.odxedit.ac@gmail.com – ODCLASS based on Xrecord

odclass.odedit.ac@gmail.com - ODCLASS based on Object Data

 

 

1.     General information about ODCLASS object definition files

Object definition file is a UTF-8 BOM encoded text file of a special structure that defines AutoCAD ® drawing parameters, definition of drawing/modeling object types, their graphical properties, descriptions of their characteristics, possible values ​​of the characteristics. All these definitions are made by the user. ODCLASS does not set any of its own parameters and settings, does not create special objects, etc. – only performs the settings and actions of users.

Object definition files are ODCLASS key elements. On the one hand, it is the source of object types definitions and their characteristics, the source of the required objects’ graphical properties data. On the other hand, it is an opportunity to check for a match between DWG graphical elements object definitions with given characteristics/properties and the required ones stated in the definition files. This gives an unambiguity to control data correctness, to select objects according to their essential features, it makes it possible to determine any characteristics of objects, selectively assign the desired graphical properties, restore graphical properties specified, etc. Object identifiers of DWG graphical elements and defined characteristics turn graphical drawings/models into object models, suitable for software analysis and control, for transfer to information systems.

Creating object definition files is the most time consuming and most responsible process when working with ODCLASS. The laboriousness is primarily related to the unusual workflow – graphical drawings/models are created largely based on intuitive perception, while 100% formalized definition is not required. The laboriousness is often associated with the significant number of object types and their characteristics to be described. But these difficulties are compensated by the ability to use the created definition files unlimited number of times by unlimited number of users.

Object definition files are a formalized description of the drawing/modeling subject, and can play the role of drawing/modeling standards description, ensuring the unity of object types, their characteristics, standardization of design, etc.

Definition files for a specific project can be distributed to many implementers while its’ usage in ODCLASS will ensure full compatibility of the created drawings/models and descriptive object data. Definition files for internal standards of organizations will make it possible to match these standards not only within the organization, but also among partners and hired third-party contractors. Definition files for departmental and other standards will allow the creation of standards-compliant drawing/models by any implementer.

The structure of an object definition file is consciously made not xml-type to ensure compactness, transparency and simplification of manual creation and editing by any user.

The structure of ODCLASS object definition files is defined in ODCLASS_definition_file_structurehtm or pdf.

Verification of the formal correctness of definition files is performed when loading ODCLASS. AutoCAD message window displays information about definition files errors and warning.

Experience shows that when creating object definition files with any method, manual editing in any text editor is required and more convenient.

 

2.     ODCLASS variables definition

Definition file internal variables description is optional.

ODCLASS internal variables definition is done manually. Internal variables are defined with lines beginning with "Define ...". For example:

Define date $(year)-$(month)-$(day)T$(hour):$(minute):$(second) – definition of the internal variable "date", 0000-00-00T00:00:00 format.

 $ (...) – is the use of variables.

 

3.     DWG and drawing settings and parameters definition

DWG and AutoCAD settings and parameters description in the definition file is optional. Or, on the contrary, the definition file may contain only the description of settings and parameters with AutoCAD variables.

DWG and AutoCAD settings and parameters definition is advisable to determine manually in most cases, because different projects may require different parameters and settings.

DWG and AutoCAD settings and parameters are defined with lines beginning with "Variable ...". For example:

Variable       INSUNITS    6

Variable       LUPREC       3

 

4.     Drawing resource files definition

Drawing resource files description in the definition file is optional. Or, on the contrary, definition file may contain only drawing resource files description.

In definition file, it is almost always necessary to define the sources of drawing resources manually – paths to libraries of blocks, layers, linestyles, hatches, texts, etc. For example:

BlockReference     D:\*_block.dwg

Layer D:\layer_template.dwt

The paths can be either absolute or relative.

 

5.      Object types menu classification definition

Class and classification definition are optional.

In definition file, it is almost always necessary to define the division of many types of drawing/modeling objects into subclasses, and other groups manually. Even a small set of object types should be presented as divided into groups (classified). This is done to display multiple object types in ODCLASS object menu in the form of a hierarchical list, a drop-down menu for convenient selection from the object menu, for convenient selection in object groups window.

Classes and subclasses of any level are defined with a pair of lines:

Class Name ...                 – class definition beginning

/Class                    – class definition end

Subclasses, which definition is between such a pair of lines, belong to this class:

Class Name 1 ...              class definition beginning

          Class Name 2 ...    – subclass definition beginning

          /Class                    – subclass definition end

/Class                    – class definition end

Objects, which definition is between such a pair of lines, belong to this subclass.

Classification depth is unlimited.

The division of a set of object types into subclasses can be completely arbitrary or it can illustrate standardized classification of object types, if such a standard exists for the subject of drawing/modeling. Ultimately, the division into subclasses is determined only by the convenience of work with the object menu.

Classes, subclasses with no defined objects are not displayed in the object menu. Object definitions can be placed outside the classes and will always be displayed in the object menu after the classes.

 

6.     Object types definition

Object types definitions are optional.

Object types definitions can be created:

1. Manually, in a text editor.

2. Programmatically, by ODCLASS_TEMPLATE, ODCLASS_TYPE commands.

3. Programmatically, Tool Palettes with XTP_2_ODCLASS utility.

4. Programmatically, from various classifiers and other files with object definitions (GIS Panorama cartographic classifiers, etc.)

When defining object types, some manual editing in a text editor is almost always required.

 

6.1.         Creation of object definition manually

Manual object definition is made in accordance with ODCLASS_definition_file_structure_R-4 – htm or pdf.

Also, manual object definition is made by copying and editing the desired definitions from existing definition files.

ODCLASS_TYPE command is used to define the names of the primitive types.

 

6.2.         Creation of object definition files with ODCLASS commands

ODCLASS_TEMPLATE command can be used to create a definition of all (or specified) objects of an existing drawing/model at once in accordance with their graphical properties. For the specified graphical elements of the active DWG, this command creates a template text file, a description of all objects that differ in a unique set of basic graphical properties – layer, color, weight, linetype, etc. A definition of all the Xrecord or Object Data being in this DWG is created at the end of the definition file.

 

6.2.1.   Creation of object types definition and their graphical properties with ODCLASS commands

Object type names are created based on the specified keys and user-defined delimiters.

For example:

% T_% i_% L_ – forms object type name based on AutoCAD primitive name, underline, conditional number, underline, layer name.

Object type names created with ODCLASS_TEMPLATE are conditional, since are created on the basis of graphical properties. It is necessary to replace them with the object type names of drawing/modeling subject. In addition, since the command is based only on the uniqueness of the graphical properties, many of the selected object types become redundant. And it is required to unite selected object types into one. For example, selected object types that differ only by linetype scale can be of the same object type while different linetype scales were specified accidentally.

The opposite is also possible – different object types are drawn the same style with the same properties. In this case, it is necessary to copy object type definition and give these copies different object type names.

 

6.2.2.   Creation of object characteristics definition and their allowable values with ODCLASS commands

All object types created with ODCLASS_TEMPLATE have the same “OD_NAME” characteristics table with one “OD_KEY” field:

od_name OD_NAME

od_key OD_KEY

The "od_key" field is a required field in the tables, intended for object type names. The name of "OD_KEY" key field, created by the command ODCLASS_TEMPLATE, is conditional and can be replaced with any desired one.

If object definitions are created only to organize drawing then such an automatically generated table is sufficient.

If it is intended to define object characteristics, then it is necessary to define all the required tables for the characteristics and all the required fields for these characteristics. ODCLASS_TEMPLATE command uploads table definitions to the text file if DWG contained any. Table definitions are uploaded after all object type definitions of the source DWG. If these tables are necessary for object characteristics definitions, then these table definitions can be transferred or copied into the definitions of the corresponding objects. Replacing the original definitions of "OD_NAME" table.

If necessary, tables definitions can be edited, provided that the set of fields, filed names and their type is the same for the tables of the same name.

The table fields for object characteristics are defined with rows beginning with "od_fld", for example:

od_fld AREA description Real -20000.00 -10000.00: 10000.00

od_fld NAME description required Character

od_fld TYPE description Character TYPE1 TYPE1, TYPE2, TYPE3

Field definitions contain field names, their descriptions, data types (integer, string, real), default values, ranges of allowable values, lists of possible values.

 

6.3.         Creation of object definitions from AutoCAD Tool Palettes with XTP_2_ODCLASS utility

XTP_2_ODCLASS program allows to create object type definition files from Tool Palettes files – xtp and atc files. Thus, only object types and their graphical properties definitions are created. Object characteristics definitions are missing in Tool Palettes, and therefore are not created.

 

6.4.         Creation of object definitions from various classifiers and other files with object definitions (GIS Panorama cartographic classifiers - RSC_2_ODCLASS utility, etc.)

ODCLASS object type definition files have various analogues – classifiers, codifiers, standards and other documents.

To convert such documents, provided they have a certain formalized structure, one can create additional utilities.

For example, there is an additional utility RSC_2_ODCLASS, which allows to convert GIS Panorama RSC.TXT mapping classifiers into ODCLASS object type definition files. Thus, complete object type definitions are created – with the characteristics and their allowable values definitions.

 

After the creation of the definition file, this file can be loaded with ODCLASS_LOAD command, while its contents will be displayed in ODCLASS object menu window. After the successful loading of the definition file, ODCLASS is ready to comprehensive work with the data – drawing, defining the existing graphical elements, etc.

 

 

ODCLASS, Version 1.19.2

Alexander Sharov ©   Russia, Moscow

odxclass.odxedit.ac@gmail.com – ODCLASS based on Xrecord

odclass.odedit.ac@gmail.com - ODCLASS based on Object Data

 

08.12.2018