Differences between revisions 6 and 7
Deletions are marked like this. Additions are marked like this.
Line 59: Line 59:
The following example shows a simple document doc with three components: The following example shows a simple document code with three components:
Line 128: Line 128:
|| nullClip || Number of characters to remove from code if this component is empty. For removing separaters ||
|| parse || Length (if numeric), or constant text, or regular expression (if starting iwht slash character) used to parse/extract the component from user input ||
|| nullClip || Number of characters to remove from code if this component is empty. For removing separators ||
|| parse || Length (if numeric), or constant text, or regular expression (if starting with slash character) used to parse/extract the component from user input ||

Drawing Code Handling

  1. Drawing codes are composed of components, each of which (generally) has a meaning.
  2. The drawing code components can be mapped to classification (and other fields) in the Drawings record.
    • Maps may be direct (to reference tables) or indirect, e.g. via drawing code map tables (see below).
  3. There is a complex syntax described in SomePage (?)

    • Drawing codes structures are defined in app/config/Settings-DrawingCode.php

    • Drawing code functionality is implemented in app/lib/DrawingCodeBase.php

Drawing Code Definition

The drawing code definition is defined in:

  1. The database table DrawingCodeTypeRef, where an id, code and name for each drawing code type is defined.

  2. The configuration file app/config/Settings-DrawingCode.php, which defines all the components of each drawing code.

Drawing Code Component Definition

The drawing codes are defined in the $_CFG settings array.

Each Drawing Code has two parts:

  1. DrawingCode - defines each drawing code component and separator

  2. RevisionCode - defines:

    • each revision code component
    • revision numbering rules (starting revision number, are gaps allowed)
    • file storage rules for the publish and source files (how the files are named internally)

Top-Level Configuration

   $_CFG[ 'DrawingCodeDefinitions' ] = array(

     DrawingCodeTypeRef_DC1 => array( // KEJV: 14-C-9.99.999
       'name' => 'KEJV',

       'drawingCode' => array( // KEJV Drawing code definition
         'components' => array( ... )
       ),

       'revisionCode' => array( // KEJV Revision code definition 
         'components' => array( ... )
         ...
       ),
     ),

     DrawingCodeTypeRef_DC2 => array( // ...
       ...
     ),
   ),

Component Definition

Components are defined as a series of arrays (starting with component zero):

The following example shows a simple document code with three components:

  • Drawing Code

    X

    -

    9999

Components

  • Component

    Name

    Description

    X

    Category

    Engineering discipline, a single character taken from the field CategoryRef.code

    -

    Separator

    Constant text

    9999

    Sequence

    Four-digit sequence number

This is the definition in app/config/Settings-DrawingCode.php

       'drawingCode' => array( // Example drawing code definition
         'components' => array(
           array( // Category
             'name'               => 'Category',
             'type'               => 'select',
             'length'             => 1,
             'rmTable'            => 'CategoryRef',
             'rmCode'             => 'code',
             'rmName'             => 'CODE_NAME',
             'rmField'            => 'categoryId',
             'parse'              => '/^[A-Z]{0,1}$/',
             'pattern'            => '/^[A-Z]{1,1}$/',
             'fieldOut'           => 'categoryId',
           ),
           array( // Separator
             'type'               => 'constant',
             'value'              => '-',
             'parse'              => '-',
           ),
           array( // Sequence number
             'name'               => 'Sequence Number',
             'type'               => 'manual',
             'length'             => 4,
             'formatCode'         => '%04d',
             'fieldOut'           => 'drawingNo',
             'formatOut'          => '%d',
             'parse'              => '/^\d{0,4}$/',
             'pattern'            => '/^\d{1,4}$/',
           ),
         ),
       ),

Notes about the components:

  1. The category is a select field of a single character, and maps directly to Drawings.categoryId.
  2. The separator is constant text.
  3. The sequence number is a manual entry value, which must be numeric. It maps directly to Drawings.drawingNo.

There are many component keywords. The complete list of valid keywords is defined below.

Component Keywords

Keyword

Description

counterIn

Name of counter field (See below)

fieldIn

Name of field used for initializing the componenet value

fieldOut

Name of field to which the component value should be copied

formatCode

Printf style format code used for building the code

formatIn

Scanf style format code for converting the component into a value for entry

formatOut

Printf style format code used for converting the component into into the destination field

frameIn

Name of session frame variable for retrieving the conponent value

length

Component length in characters

mapId

Id value for an indirect map. Maps to DrawingCodeMapRef.mapId (see below).

name

Name of component, use for building a validation tag

nullClip

Number of characters to remove from code if this component is empty. For removing separators

parse

Length (if numeric), or constant text, or regular expression (if starting with slash character) used to parse/extract the component from user input

pattern

Length (if numeric), or regular expression used to parse/extract the component from the code

readonly

Set to true if the component cannot be modified

replaceIn

Two component array of: 1) search regular rexpresssion, 2) text that it should be replaced with

required

Set to false if component is options. Defaults to true if not present

rmCode

Direct map: Field name (from target table) to use as value for component (typically code)

rmField

Direct map: Target field name

rmFilter

Direct map: Filter field name, Typically contractId

rmFilterValue

Direct map: Filter constat value.

rmName

Direct map: Name of field(s) to display in list (typically, code, name or CODE_NAME)

rmTable

Direct map: Target table name

type

Component type. See below.

value

Constant text for fields of constant type

Component Types

Type

Description

constant

Component is constant text, typically used for separator characters

counter

Component is a numeric counter. (See below)

manual

Component is manual entry (e.g. no select list is available). Typically used for sequence numbers

select

Component is a select list, requires that a mapping is defined

Revision Keywords

Keyword

Description

firstRevisionNo

Initial revisionNo value. Typically 0 or 1

gapsAllowed

True is revisionNo gaps are allowed

publishFilenameFields

publishFilenameFile

publishFilenameFormat

publishFilenameName

publishFilenameReplace

revisionNumberComponent

sourceFilenameFields

sourceFilenameFile

sourceFilenameFormat

sourceFilenameName

Allowed values: code, format, free. See below

sourceFilenameReplace

Filename Name Handling

keyword

Value

code

The file must be named exactly according to the document code

format

The file name is determined by a regular expression transformation of the drawing code

free

The file name ununrestricted

Counters

to be completed

Drawing Code Maps

Drawing code maps allow classification (and other) fields to be directly set based on drawing code components. This is main mechanism for automatically setting classification fields based on a drawing code.

There are two kinds of maps:

  1. Direct maps - map a drawing code component value directly to the code of the target field

  2. Indirect maps - which use DrawingCodeMap tables to map from a drawing code component

    • value to one (or more) target field/values pairs.


Examples

Mapping from Drawing Code Components to Classifications

  1. Uses the following tables:

Examples

Example component ''languageCode'' for the MET Drawing Code

  1. In DrawingCodeMapRef:

    • id=1002, name='Language Code'
  2. In DrawingCodeMapCodes:

    • EN - English
    • EH - English/Hungarian
    • HU - Hungarian
  3. In DrawingCodeMapValues, if these codes mapped to a classification (which currently they do not), we

    • can put (nultiple) mappings of target (field, value) tuples. Note that the field refers to the form (? check this)

    • HU --> Drawings.languageId, 3 (3=Hungarian)

Note that this is not yet implemented for V12.x, e.g. for aspect based classifications.

Example: Mapping Projektphase (c) to ProjectPhaseRef in Axpo/NOK DrawingCode

Example: Mapping a Subset of Fachbereich (cc) to CategoryRef in Axpo/NOK DrawingCode

The problem is to map a subset of the Fachbereich (CategoryRef table) from a drawing code component to the Fachbereich

DrawingCodeHandling (last edited 2011-03-30 11:28:30 by 195)

Copyright 2008-2014, SoftXS GmbH, Switzerland