In CET development we use the keyword 'part' for BoM (Bill of Material).
Snapper Interface
Implement getParts()
to add parts. It can be one part per Snapper
or several. The parts are added to the PartsEnv
and then merged together. Merged means that same components are shown on one row in calculation dialog and the quantity and price etc are updated.
/** * Before get parts. */ extend public void beforeGetParts(PartsEnv env) { } /** * Get parts. */ extend public void getParts(PartsEnv env, Snapper{} visited) { } /** * After get parts. */ extend public void afterGetParts(PartsEnv env) { }
Part Column
A part column is the columns shown in the calculation dialog.
By default, there are only 7 columns enabled. The default columns can be added and removed based on a voting system as detailed here.
There is a basic set of columns registered with CET but customers can also add their own and override an existing column. Base class for part column is found tcm/core/part/partColumn.cm
Options
Many of our customers use what we call Options in the calculation. Options are additional information rows on each part. It can be the type of material or other options on the component. The options can be shown in one of the core columns like Description or you can add your own column. The concept PartInfo
tree is used to handle options. See cm/core/part/partInfoTree.cm.
DsPart
A hybrid Snapper will usually make use of an implementation of DsPart
, wherein the Snapper's getPart()
, it'll return the DspData
/DsMultiPData
's getPart()
.
Refer to the Fika extension's FikaDataSnapper
for an example implementation:
/*********************************************************************** * Parts. ***********************************************************************/ /** * Get parts. */ public void getParts(PartsEnv env, Snapper{} visited) { if (DsPData data = getData) data.getParts(this, env); visited << this; }
Length Parts
A common problem is that you need to deliver a number of fixed length items to cover a certain need. In core, there are some base classes to solve this issue. See cm/core/lengthParts.cm, and an example of an implementation in cet/consumer/consumerTestSnapper.cm.
Part Hooks
In some cases, there are parts that are included in order even if they do not belong to a specific component in the drawing. They can be added with hooks. You can also use hooks to optimize parts or do different calculations on the drawing before or after parts are being finalized. Information about part hooks can be found in cm/core/part/partHooks.cm.
Order Export
In order to send the information about the parts to an order system, the user has to do an export. In core, there is a base class for export of parts data in cm/core/orderExporter.cm. There is also a base class for text export in cm/core/textExporter.cm, and a fully implemented ofdaXML exporter in cm/abstract/ofdaXML/ofdaXMLExport.cm. The exporters have to be registered and then they show up as an option in the calculation dialog. The user can either export per view or for the entire drawing.
Comments
0 comments
Please sign in to leave a comment.