ITK Function Reference

(V10000.1.0.60_20160308.00)
Data Structures

Data Structures

struct  BOM_writer_format_ajt
 
struct  BOM_writer_format_empty
 
struct  BOM_writer_format_flatten
 
struct  BOM_writer_format_plmxml
 
union  BOM_writer_format_u
 
union  BOM_writer_output
 
struct  BOM_writer_output_file
 
struct  BOM_writer_output_smstring
 
struct  BOM_writer_struct
 
struct  BOM_writer_traversal
 

BOM Writer - format user callback definitions

typedef char *(* BOM_writer_userfunc_t )(tag_t bomline, tag_t parent, void *transform, int node_reason, int depth, void *userdata)
 
#define BOM_writer_node_unset   0
 
#define BOM_writer_node_selected   (1<<0)
 
#define BOM_writer_node_ancestor   (1<<1)
 
#define BOM_writer_node_descendant   (1<<2)
 
#define BOM_writer_node_leaf   (1<<3)
 
#define BOM_writer_node_assy_geom   (1<<4)
 
#define BOM_writer_node_subselected   (1<<5)
 
#define BOM_writer_node_subancestor   (1<<6)
 
#define BOM_writer_node_subdescendant   (1<<7)
 

User Attribute prefix strings

#define BOMWRITER_UA_TARGET   "target:"
 
#define BOMWRITER_UA_PREF   "pref:"
 
#define BOMWRITER_UA_ATTRMAP   "attrmap:"
 
#define BOMWRITER_UA_KEY   "key:"
 
#define BOMWRITER_UA_PROP   "prop:"
 
#define BOMWRITER_UA_ATTR   "attr:"
 
#define BOMWRITER_UA_LITERAL   "literal:"
 
#define BOMWRITER_UA_PROPUID   "propuid:"
 

Output Formats

How the BOM Window looks when it's written out

enum  BOM_writer_ajt_style_e {
  BOM_writer_ajt_file_url, BOM_writer_ajt_file_unix, BOM_writer_ajt_file_nt, BOM_writer_ajt_file_native,
  BOM_writer_ajt_file_user, BOM_writer_ajt_file_uidtag, BOM_writer_ajt_file_webtag
}
 
enum  TransformType_e { TransformType_None, TransformType_Cumulative, TransformType_AbsOcc, TransformType_AbsOcc_Then_Cumulative }
 
typedef char *(* BOM_writer_empty_ep_t )(tag_t bomline, tag_t parent, void *transform, int node_reason, int depth, int count, void *userdata, int *prune)
 
typedef int(* BOM_writer_asktform_t )(tag_t bomline, int depth, void **transform)
 
typedef int(* BOM_writer_combtform_t )(void *transform1, void *transform2, void **result)
 
typedef int(* BOM_writer_freetform_t )(void *transform)
 
typedef enum BOM_writer_ajt_style_e BOM_writer_ajt_file_style
 
typedef char *(* BOM_writer_ajtfilefunc_t )(tag_t dataset, tag_t imanfile, tag_t line, void *userdata)
 
typedef enum TransformType_e BOM_writer_TransformType
 
typedef union BOM_writer_format_u BOM_writer_format
 
#define BOMWRITER_AJT_ROOT_UA_TARGET   BOMWRITER_UA_TARGET "Root"
 
#define BOMWRITER_AJT_NODE_UA_TARGET   BOMWRITER_UA_TARGET "Node"
 
#define BOMWRITER_PLMXML_ROOT_UA_TARGET   BOMWRITER_UA_TARGET "Root"
 
#define BOMWRITER_PLMXML_PART_UA_TARGET   BOMWRITER_UA_TARGET "Part"
 
#define BOMWRITER_PLMXML_INSTANCE_UA_TARGET   BOMWRITER_UA_TARGET "Instance"
 
#define BOMWRITER_PLMXML_OCCURRENCE_UA_TARGET   BOMWRITER_UA_TARGET "Occurrence"
 

Detailed Description

ITK calls into the BOMWriter system

BOM_writer_write_bomwindow() traverses a bomwindow, writing its bomlines according to some file format (eg AJT, PLMXML), to an output mode (typically an open file handle).

The user has to nominate the output mode, file format, and any traversal modifiers. This is done via three pointers to structures that select the particular mode, format, or modifiers, and allow you to communicate options for each.

You should NOT allocate the structures yourself. Use the ITK calls, which fill in the default values for you and mark the structure's first field so the system can identify which format/mode you've chosen. They can only fail by exhausting memory (when the returned pointer shall be NULL, assuming it ever gets back to you).

The default values set are always zero or null, unless otherwise specified. Some defaults are invalid, to force you to set a value. You must set an explicit filehandle, for instance. Future additional options should default to backwards-compatible behaviour.

By default, packed lines are ignored except for the packmaster. You may request virtual unpacking, but this slows down traversal as lines are unpacked and repacked. It is strongly recommended that you create unpacked windows in the first place.

Example: write an AJT format file:

#include <bom/bom.h>
#include <bom/bomwriter.h>
BOM_writer_output* file_output=0;
BOM_writer_format* ajt_format=0;
BOM_writer_traversal* traversal=0;
if ( BOM_writer_new_output_file(&file_output) == ITK_ok &&
BOM_writer_new_format_ajt (&ajt_format) == ITK_ok &&
BOM_writer_new_traversal (&traversal) == ITK_ok )
{
file_output->file.filehandle = fopen("myfilename","w");

Use AJT format, but:

  1. The File "" attributes' value shall be the tcfs file path appropriate for the native system to use (Unix vs NT path)
  2. The nominated user function shall be called for each part/assembly
  3. The nominated user data shall be supplied to the user function.
ajt_format->ajt.file_attr_style = BOM_writer_ajt_file_attr_native;
ajt_format->ajt.userfunc = &user_supplied_function;
ajt_format->ajt.userdata = &datastructure_for_user_functions;
ifail = BOM_writer_write_bomwindow( window, file_output, ajt_format, traversal );
}
BOM_writer_delete(file_output);
BOM_writer_delete(ajt_format);
BOM_writer_delete(traversal);

USER FUNCTIONS

All output formats should provide one or more callbacks, to allow for some user-level augmentation of the data being emitted by the format - for instance, add attributes to AJT entries.

User functions shall typically use BOM_writer_userfunc_t, but some formats may use other function prototypes, which shall be detailed with their structure definition.

They are passed the current bomline, the bomline's parent for the purposes of file-structure (in case the flatten adapter or similar is being used) the reason the bomline has been supplied (it's one or more of: BOM_writer_node_ancestor, selected, descendant, or leaf), and any userdata the caller provided.

Note
The parent tag of the root node is the tag of the root node itself, not NULLTAG as you might expect. You should check depth==0 for the root.

BOMWriter user-functions generally return a null-terminated string that the system can send to the output system, or a NULL pointer to indicate a fatal error. BOM_writer_write_bomwindow() takes responsibility for MEM_free()ing any string returned.

USER ATTRIBUTES

Most formats have a way of presenting arbitrary key-value pairs for particular nodes in the output file. user_attributes provide a simple manner of using these to present various user-required data.

User attributes allow the user to specify that for a given format-defined target (a location or locations within the file), certain additional values should be presented. These values are generally specified as key/property or key/attribute pairs appearing after a target specifier.

Currently, AJT format supports Root and Node targets: Node representing every PRT or ASM node; Root representing the topmost Node. PLMXML format supports Root, Part, Instance, and Occurrence targets. Root represents the topmost Part node. The root targets are intended for once-per-file data, typically literal strings, perhaps to communicate the intent of the file to receiving applications (eg Merge with current tree, Delete from current tree, etc).

For example:

target:Node, key:alt_rep, prop:UG ALTREP, key:creator, attr:TOOL

The directive propuid: behaves like prop: but must be given a property that returns a tag (or tag-list), which it presents as a UID (space-separated list of UIDs). The directive literal: simply evaluates to the string given to it.

There is a special directive attrmap: which inserts all the attributes returned by the ITK call ATTRMAP_list_mappings() with key:s based on the the attributes' standard names. attrmap: is never paired with a key: of its own.

User attributes may also specify preferences that should be examined for more list items. If this sublist appears after a target: has been specified in the main list, any key/value pairs in the sublist will be inserted into that target until another target is specified in the sublist. It is an error for key: or attrmap: to be specified unless a target: has been indicated. The preference BOMWRITER_max_preference_depth controls how deeply sublists can refer to other sublists. The default is 10. Perhaps confusingly, target settings revert at the end of a preference.

For example:

target:Node, pref:some_pref

some_pref = key:alt_rep, prop:UG ALTREP, pref:other_pref, key:ID, prop:bl_item_item_id other_pref = target:Leaf, key:creator, attr:TOOL

results in Node=alt_rep/UG ALTREP, ID/bl_item_item_id and Leaf=creator/TOOL

A malformed prop/key list will cause an error. Multiple lists directed to the same target: will be concatenated/merged. An empty target-list is legal but has no effect. It is an error for one key: to have more than one value specified.

An undefined property will cause an error. An undefined preference will cause an error.

The syntax of char** user_attributes is as follows, examples follow:

user_attributes :== <target-pref-entry>* <target-specifier>* <end-attribute>

target-specifier :== <target-entry> <target-list>

target-list :=+ ( <key-entry> <value-entry>
| <pref-entry>
| <global-attrmap>
)*

target-entry :== "target:" <target id>,

key-entry :== "key:" <key string>,

value-entry :== "prop:" <bomline property name>,
| "propuid:" <bomline property tag value converted to uid>
| "literal:" <literal string>,
| "attr:" <attribute-mapped name>,

target-pref-entry :== "pref:" <preference name>,
NOTE: target-pref-entry's preference data :== <user_attributes>

pref-entry :== "pref:" <preference name>,
NOTE: pref-entry's preference data :== <target-list> <target-specifier>*

global-attrmap :== "attrmap:",

end-attributes :== NULL or 0 (null string pointer, not empty string)

eg:

char** plmxml_attributes =
{
"DesignContext_plmxml_user_attributes",
"OCCUID",
"bl_occurrence_uid",
0
};

Preference file excerpt

DesignContext_plmxml_user_attributes= target:part key:IMAN_REV_ID prop:bl_item_rev_id target:instance key:IMAN_REF_SET

prop:UG REF SET

char** ajt_attributes =
{
"attrmap:",
0
};

Structures

Insert the word 'new' after 'BOM_writer' to get each structure's allocating function: BOM_writer_output_file structures are created by BOM_writer_new_output_file().

Macro Definition Documentation

#define BOM_writer_node_ancestor   (1<<1)

Definition at line 240 of file bomwriter.h.

#define BOM_writer_node_assy_geom   (1<<4)

Definition at line 243 of file bomwriter.h.

#define BOM_writer_node_descendant   (1<<2)

Definition at line 241 of file bomwriter.h.

#define BOM_writer_node_leaf   (1<<3)

Definition at line 242 of file bomwriter.h.

#define BOM_writer_node_selected   (1<<0)

Definition at line 239 of file bomwriter.h.

#define BOM_writer_node_subancestor   (1<<6)

Definition at line 245 of file bomwriter.h.

#define BOM_writer_node_subdescendant   (1<<7)

Definition at line 246 of file bomwriter.h.

#define BOM_writer_node_subselected   (1<<5)

Definition at line 244 of file bomwriter.h.

#define BOM_writer_node_unset   0

Definition at line 238 of file bomwriter.h.

#define BOMWRITER_AJT_NODE_UA_TARGET   BOMWRITER_UA_TARGET "Node"

Definition at line 449 of file bomwriter.h.

#define BOMWRITER_AJT_ROOT_UA_TARGET   BOMWRITER_UA_TARGET "Root"

Definition at line 448 of file bomwriter.h.

#define BOMWRITER_PLMXML_INSTANCE_UA_TARGET   BOMWRITER_UA_TARGET "Instance"

Definition at line 497 of file bomwriter.h.

#define BOMWRITER_PLMXML_OCCURRENCE_UA_TARGET   BOMWRITER_UA_TARGET "Occurrence"

Definition at line 498 of file bomwriter.h.

#define BOMWRITER_PLMXML_PART_UA_TARGET   BOMWRITER_UA_TARGET "Part"

Definition at line 496 of file bomwriter.h.

#define BOMWRITER_PLMXML_ROOT_UA_TARGET   BOMWRITER_UA_TARGET "Root"

Definition at line 495 of file bomwriter.h.

#define BOMWRITER_UA_ATTR   "attr:"

Definition at line 297 of file bomwriter.h.

#define BOMWRITER_UA_ATTRMAP   "attrmap:"

Definition at line 294 of file bomwriter.h.

#define BOMWRITER_UA_KEY   "key:"

Definition at line 295 of file bomwriter.h.

#define BOMWRITER_UA_LITERAL   "literal:"

Definition at line 298 of file bomwriter.h.

#define BOMWRITER_UA_PREF   "pref:"

Definition at line 293 of file bomwriter.h.

#define BOMWRITER_UA_PROP   "prop:"

Definition at line 296 of file bomwriter.h.

#define BOMWRITER_UA_PROPUID   "propuid:"

Definition at line 299 of file bomwriter.h.

#define BOMWRITER_UA_TARGET   "target:"

Definition at line 292 of file bomwriter.h.

Typedef Documentation

typedef char*(* BOM_writer_ajtfilefunc_t)(tag_t dataset, tag_t imanfile, tag_t line, void *userdata)

Definition at line 441 of file bomwriter.h.

typedef int(* BOM_writer_asktform_t)(tag_t bomline,int depth,void **transform)

Definition at line 393 of file bomwriter.h.

typedef int(* BOM_writer_combtform_t)(void *transform1, void *transform2, void **result)

Definition at line 399 of file bomwriter.h.

typedef char*(* BOM_writer_empty_ep_t)(tag_t bomline,tag_t parent,void *transform,int node_reason,int depth,int count, void *userdata,int *prune)

EMPTY format - Lots of callbacks though

Definition at line 370 of file bomwriter.h.

Flatten's struct needs a forward reference to this union

Definition at line 551 of file bomwriter.h.

typedef int(* BOM_writer_freetform_t)(void *transform)

Definition at line 405 of file bomwriter.h.

This format implements the PLMXML format.

Since BOMWriter uses the Parasolid PLMXML Toolkit for its PLMXML abilities, any user-extension code must interact with that toolkit, which requires a C++ compiler. Since a C++ compiler must be available, the user-extensions will be supplied as a subclass of the BOMWriterFormatPLMXMLBuilder class or its subclasses (headers supplied). The user will use C++ to interact with the PLMXML toolkit, but will still use ITK from C++ to interrogate TCEng.

Although the user-extension code could be linked into a multiple-object ITK program, it is best supplied as a shared library, using a dynamic registration system, so the extension format is generally available throughout the system.

typedef char*(* BOM_writer_userfunc_t)(tag_t bomline,tag_t parent,void *transform,int node_reason,int depth,void *userdata)

Many of these input-parameter structures take function-parameters for callback routines. The callbacks often return BOM_writer_delete()able strings which are printed to the selected output mechanism and then freed by the system. Returning NULL indicates an error that should halt traversal. The callbacks often have the following parameters. Extra parameters are mentioned with the function's documentation. Unless otherwise specified, you may ignore the callback parameters and a sensible do-nothing default will be assumed.

Definition at line 257 of file bomwriter.h.

Enumeration Type Documentation

Enumerator
BOM_writer_ajt_file_url 

Default, currently unimplemented

BOM_writer_ajt_file_unix 
BOM_writer_ajt_file_nt 
BOM_writer_ajt_file_native 
BOM_writer_ajt_file_user 
BOM_writer_ajt_file_uidtag 
BOM_writer_ajt_file_webtag 

Definition at line 431 of file bomwriter.h.

This format implements the PLMXML format.

Since BOMWriter uses the Parasolid PLMXML Toolkit for its PLMXML abilities, any user-extension code must interact with that toolkit, which requires a C++ compiler. Since a C++ compiler must be available, the user-extensions will be supplied as a subclass of the BOMWriterFormatPLMXMLBuilder class or its subclasses (headers supplied). The user will use C++ to interact with the PLMXML toolkit, but will still use ITK from C++ to interrogate TCEng.

Although the user-extension code could be linked into a multiple-object ITK program, it is best supplied as a shared library, using a dynamic registration system, so the extension format is generally available throughout the system.

Enumerator
TransformType_None 
TransformType_Cumulative 
TransformType_AbsOcc 
TransformType_AbsOcc_Then_Cumulative 

Definition at line 515 of file bomwriter.h.