Flux-MetaCAM interface
This explains how Flux interfaces with MetaCAM.
Locating MetaCAM
Flux locates the MetaCAM installation by looking for some registry entries. First, it looks in the HKEY_CURRENT_USER\SOFTWARE\Metamation\MetaCAM location for the Home entry. If it can find that, that is the MetaCAM installation folder and it then looks for a metacam.exe in that folder.
Else, it looks in the HKEY_CLASSES_ROOT\CLSID{44A73BF9-B0C5-49ce-AA52-FB475FA7FBE6}\LocalServer32 registry key. If it can find that key, that should contain the complete path and filename of the MetaCAM executable. One or both of these registry entries will normally be set if MetaCAM is installed using the typical MetaCAM installation process.
On some developer machines, or on machines used by support engineers, there may be multiple MetaCAM installations, and you may want to tell Flux to use a particular one. That is done by setting the MCAMPATH environment variable. This variable should be set to the name of the directory where MetaCAM is installed.
For example:
set MCAMPATH=C:\Work\MetaCAM\1018\Bin
If this environment variable is set, it overrides any values read from the registry.
The Trek utility
Every copy of Flux is bundled with a special version of MetaCAM (called trek.exe). You can find this is in the Trek folder inside the Flux installation. This special version of MetaCAM has no user interface, and can be used only by Flux. It is used to convert files to and from MetaCAM formats. For example, when you try to open a PDG file from Flux, trek.exe is used to convert that to a file that Flux can read. The bundling of the Trek utility with Flux means that Flux can read and write MetaCAM formats without requiring a MetaCAM license to be installed on that computer.
Refer Trek command line reference section that explains various command line parameters for Trek.
Trek source code and compilation
Sometimes, Trek application requires changes to fix some bugs like this.
Steps to compile Trek:
-
Clone the source code for Trek available here
-
Use default branch of Trek
-
Trek requires the drive mapping U: to include trek.pch and U: is mapped to the X:\Src folder
-
Don’t set the TrekPath in the Environment variables. The standalone Flux expects it in the <Bin>\Trek folder (where <Bin> is the Flux.exe install location).
-
Use V10 version of MetaCAM and clone the source code available here
-
Both source code should be in m: - m:\IMMSrc for Trek and m:\work for MetaCAM
-
To compile MetaCAM, VisualStudio 2010 should be installed as 2010 platform toolset is required
-
Now, Trek should compile properly
-
Make changes in MetaCAM/Trek (mostly MetaCAM) to fix the bug and push the changes to the respective repo
-
To test the fix in Flux, copy Trek.exe, t-lego.dll and t-assist.dll from m:\work\MetaCAM\bin to X:\Src\Bin\Trek folder
-
Trek.exe, t-lego.dll and t-assist.dll should be pushed to Flux repo
Export flats to MetaCAM
A typical workflow is that Flux is used as an unfolder to convert 3D models to flats. These unfolded models are then sent to MetaCAM for further laser or punch processing. The simplest way to do this is to turn on the Start MetaCAM when PDG files are exported setting in the Settings ● Import/Export page. Then, the part can be sent directly to MetaCAM:
-
Unfold a part and make sure you are in the 2D view of the part (shortcut key: 2)
-
Choose File ● Export and export the part as a PDG file
-
MetaCAM starts and opens the exported PDG file, ready for further processing
Material mapping
Flux works with much fewer materials in the material table than MetaCAM does. In MetaCAM, different material names are sometimes used to indicate the same material with different cutting gases (like SUS-O2 and SUS-N2). Sometimes, different material names are used to indicate the same material with different bending tools. Flux avoids this messy situation by having the different materials actually correspond to different physical materials, like Steel, Aluminum or Stainless.
Each of these Flux materials is further subdivided into a set of raw materials which is just a combination of a material and a thickness[1].
Materials are stored in Flux in the material.curl file (which can be found in the Data\System folder of the Flux installation). This is a text file that can be edited with any text editor (but do this carefully!). Here is a (somewhat abridged) data for one material:
{ Id:1 Name:1.0038 Tensile:425 FoldTensile:400 EModulus:210000 Density:7.85
DINName:St37 ASTMName:A570Gr.36 SpringbackFactor:1
AltNames:[ 1.0038 St37 Fe360 "40 B" ST AE235 RSt37-2 "BSt 3 sp 2" "NS 12 124" St360 Fe DC01 DC03
"Fe P0X" C CR4 AP00 1142 A366 Steel S235JR RSt37-2 "UNS K01500" "UNS K01702" "UNS K02401"
"UNS K02502" "UNS K03000" Fe360BFN SS330 ST
]
BendKFactor:[
{ RTRatio:1 KFactor:0.38 } { RTRatio:2 KFactor:0.43 } { RTRatio:3 KFactor:0.5 }
]
CoinKFactor:[
{ RTRatio:1 KFactor:0.41 } { RTRatio:2 KFactor:0.46 } { RTRatio:3 KFactor:0.5 }
]
RawMaterials:[
{ Name:ST#20 Thickness:0.953 } { Name:ST#19 Thickness:1.11 } { Name:ST#18 Thickness:1.27 }
{ Name:ST#17 Thickness:1.43 } { Name:ST#16 Thickness:1.59 } { Name:ST#15 Thickness:1.79 }
{ Name:ST#14 Thickness:1.98 } { Name:ST#13 Thickness:2.38 } { Name:ST#12 Thickness:2.78 }
{ Name:ST#11 Thickness:3.18 } { Name:ST#10 Thickness:3.57 } { Name:ST#9 Thickness:3.97 }
{ Name:ST#8 Thickness:4.37 } { Name:ST#7 Thickness:4.76 } { Name:ST#6 Thickness:5.16 }
]
}
Here is the process Flux uses to map material names to MetaCAM.
-
First, Flux queries the MetaCAM installation to get the list of all the material names that are available in that MetaCAM configuration.
-
Then, it takes the raw material (material + thickness) combination for that part, and looks it up in the list of RawMaterials (as seen in the material database above). If there is a matching RawMaterial entry for the part’s thickness, then it takes that RawMaterial’s name and checks if that is available in MetaCAM. If so, that becomes the MetaCAM material name for the part. So, a Flux material of St37, with sheet thickness 2.38mm will map to the MetaCAM material name ST#13 (assuming that is available in the MetaCAM configuration file).
-
Else, it looks through all the alternative names for the material (you can see these names in the AltNames field above). If any one of these alternative names is found in the MetaCAM configuration file, then that becomes the MetaCAM material name for the part.
In general, we discourage using MetaCAM material names like ST#20 or GALV-034 etc. These material names are not good because they encode both the material and the thickness in the name, and cause a lot of confusion downstream. Unfortunately, there are many MetaCAM configuration files (especially in the US) that use this kind of material naming. So, we have to support this mapping.
The correct way of mapping material names from Flux to MetaCAM is by using only the AltNames field, and that is designed to handle correctly the different names materials have in different countries. If this method is consistently followed, then the list of RawMaterials in each material is really redundant, and can be deleted. All Flux needs to work correctly is the Material; the RawMaterial is used only during such import[2] and export operations.
Trek command line reference
The Trek application is a special command-line version of MetaCAM used by Flux and Praxis. This section explains the various command line parameters for Trek.
Command Line
Trek commands take the form action param1 param2 … The command line parameter naming the action is followed by zero or more parameters required for the action. The action is not case sensitive.
3DtoL3D input output
Converts the input MetaCAM 3D model to the output L3D file (which Flux can then read as a Mesh).
DXFtoPDG input name material thickness output
Converts a DXF file to a PDG file. Here are the parameters. This can also be done as a sub-command of the PraxCMD action. If there is a single file to convert this is much more convenient, while the PraxCMD is designed for use by Praxis when it is converting multiple DXFs to PDGs.
Parameter |
Meaning |
input |
The full filename (with path) of the input DXF file |
name |
The name to be assigned for the part |
material |
The MetaCAM material to be assigned for the part |
thickness |
The thickness (in mm) to be assigned to the part |
output |
The full filename (with path) of the output PDG file |
ExpMCSet mcid output
Exports all the settings for a particular machine, specified by machine ID (these are the settings that we save in the config.dat when we do a Save as default for machine). The settings are exported as an INI file that Flux knows how to read, and these are then written into the settings.curl file for that machine. This command is used by Flux.Migrate when it imports a machine from MetaCAM to Flux
ExpMCMatlSet mcid matlid thickness output
Exports all the settings for a particular <machine, material, thickness> combination into a settings INI file. The machine and material are specified using their integer IDs. The format of this settings file is similar to the one exported by ExpMCSet, and this is also used by Flux.Migrate when it imports a machine from MetaCAM to Flux.
EnumSet output
This enumerates all the various combinations of <machine, material, thickness> tuples for which settings exist in the config file. This can then be the basis for repeated ExpMCMatlSet to extract each of these settings. The output is in a simple INI format, and is used by Flux.Migrate when it imports a machine from MetaCAM to Flux.
ListMC output
This lists all the machines in the config file in a simple INI format
ListMetal output
This lists all the materials in the config file, in a simple INI format
PraxCMD cmdfile
This parses and executes a command file that contains multiple commands in it. The point of the command file is that one can submit a large batch of commands that all get executed during one invocation of Trek. The cmdfile is an INI file that has a [Header] section with a count of actions, and a set of sections called [Action 1] .. [Action N] that provide the data for the actions. These individual actions are detailed in the section below. In addition, the [Header] section also provides the name of an output result file. This is an INI file that Trek will create and will populate this INI file with the results for each action. Corresponding to each action, there will be a similarly numbered [Result N] section, and the exact content of the report section will depend on the action. If a client is not interested in the results for a set of actions, this Results file can simply be left blank.
Note: This Results key contains the overall output result for all the actions in the file. It is primarily useful now for the ToolUpPDG actions, since one often requests multiple tool-up actions in one batch, and all the results for all the tool-up actions are reported in a single results file.
Command File Actions
A set of commands can be passed in a command file, and Trek will then execute these commands one by one, and will exit once all the commands are complete. The command file is just an INI file, like this:
[Header]
Count=2
Results=C:\Out\Result.ini
[Action 1]
Command=cmd
parameters
[Action 2]
Command=cmd
parameters
Each section is a particular command action (identified by the Command key) and the following lines contain parameters specific to that action. These are the command actions available:
DXFtoPDG
The DXFtoPDG action is used to convert a DXF file to a PDG file
Parameter |
Example |
Meaning |
Command |
DXFtoPDG |
|
Input |
C:\Data\00\Input.dxf |
The name of the input DXF file |
Name |
Valence |
The name that should be assigned to the part |
Grain |
H |
The part grain. A value of H or Horizontal sets a horizontal grain, and a value of V or Vertical sets a vertical grain. Any other value, or a missing key for Grain means that the part has no grain setting. |
Material |
Steel |
The material that should be assigned when this is saved as a PDG file |
Thickness |
1.0 |
The thickness that should be assigned |
Output |
C:\Data\01\Valence.pdg |
The full path and filename where the output is to be saved |
NoDelete |
0 |
If set to 0 (the default), the Part that was loaded is discarded after we have saved it to DXF. If this is set to 1, then the Part is stored as the global CurrentPart and is used as the input for the next operation. |
ToolUpPDG
This is used to tool-up a PDG part for a given machine.
Parameter |
Example |
Meaning |
Command |
ToolUpPDG |
|
Input |
C:\Data\01\Valence.pdg |
The file from which the input PDG should be read in. It is possible to leave this blank if the previous Action in the same command file used the NoDelete flag. In that case, the part that was loaded as part of the previous command would have been stored as the global CurrentPart and is used as the input for this operation. |
Machine |
1709 |
The ID of the machine to use for tooling up the part |
Material |
Steel |
The material to assign when tooling up this part |
Thickness |
1.0 |
The thickness to assign before tooling up this part |
Output |
C:\Data\Valence_1709.pdg |
The output file where the tooled-up part should be saved |
ICode |
C:\Data\Valence_1709.ic |
Optional: The location where the I-Code for this file should be saved. You can omit this key to avoid generating ICode |
NoDelete |
0 |
If set to 0, the part is discarded after saving the output and ICode. If set to 1, the part is stored as the global CurrentPart and can be used as the input for the next operation. |
See the entry in the Command File Results section of this document for details on the results returned from a ToolUpPDG operation
DoNesting
This is command is used to invoke a nesting operation using Trek.
Parameter |
Example |
Meaning |
Input |
C:\Nest\test.ndf |
The input file for nesting (should be an NDF file, though a JOB file is also accepted) |
Output |
C:\Nest\results.ini |
An INI file where the results are written. Note that the DoNesting action does not use the [Header]/Results global results file; it produces a separate results file for each nest. |
Folder |
C:\Nest\ |
A folder name where the nested layouts, I-Code, NC-Code should be written. Note: it is important for the folder name to end with a \ |
After nesting, a results file is produced (for each nest). And several other output files (LYT files, NC files etc) are produced. These are just sequentially numbered 1.lyt, 2.lyt etc. So, if you have a command batch with multiple DoNesting operations, it is important to specify a separate Folder for each one, so the outputs don’t get mixed up.
Note: It is probably better to submit DoNesting tasks one at a time - create a command file with just one action when you are doing nesting. The intrinsic work involved in nesting is high enough that there is not much benefit by batching nests together.
The output file is an INI file, and it contains a header like this:
[Header]
Error=0
Patterns=3
An error code of 0 means no error, while +ve values mean various different nesting errors. Following the header, is a section like this for each pattern (numbered starting from 1)
[Pattern 1]
Sheet=2500x1500
Thickness=1
Copies=1
Parts=12x1,3x2,8x7,12x8,9x9
ICode=c:\Nest\0.ic
NCCode1=c:\Nest\0.nc
Layout=c:\Nest\0.lyt
PartArea=2833524.89
SlugArea=23976.88
SkeletonArea=892498.24
TotalTime=1101.44
PunchCount=0
CutLength=64416.5
NestBound=27,1473,2464.81,100.492
ToolCount=0
The Parts value is a set of key-value pairs of tuples, and each tuple has a repeat-count x part-index, where the part indexes match the indices from the [Part N] section of the NDF file. Thus, these part indices start from 1.
If this is a nest for a punch machine, the ToolCount is set to the total number of tools used for this layout, and there are Tool entries (matching exactly the Tool1, Tool2 entries produced by the output of ToolUpPDG).
ToolCount=7
Tool1=c7c894d2-5eb6-447d-bed6-f8411bfcbf84,RE, 29.9974;5.0038;0;0;0;0;0;0, 0,6,Yes,A,4,""
Tool2=71292a2b-77a4-49c0-85e5-27e65975f6e1,RE, 56.896;10.414;0;0;0;0;0;0, 0,7,Yes,A,4,""
Tool3=90f7b048-238e-4f9a-9709-b8064528dc78,SQ, 19.05;0;0;0;0;0;0;0, 0,11,Yes,A,48,""
Tool4=e357c5d4-0d69-407c-8fbb-af1fc373f27c,RE, 75.0062;5.0038;0;0;0;0;0;0,0,14,Yes,A,634,""
Tool5=83307323-65c6-41b7-b9f7-f9cc391bf497,RE, 38.1;3.175;0;0;0;0;0;0, 0,19,Yes,A,8,""
Tool6=f1c9cda6-e79a-4e6f-b7a2-6e4bda4c6238,RE, 36.83;13.97;0;0;0;0;0;0, 0,22,Yes,A,4,""
Tool7=3bbc1840-2d02-462b-bdf9-ea6da003a770,RE, 52.07;8.001;0;0;0;0;0;0, 0,34,Yes,A,24,""
See the section below on Command File Results of the ToolUpPDG command to understand the ToolN entries.
Command File Results
Corresponding to each action above, the results file will contain a section with a similar number, called [Result N], that contains the results of the processing. This global results files (for an entire batch of commands) is used only for a few commands, including ToolUpPDG. Other commands such as DoNesting produce a separate results file for each action.
ToolUpPDG
The following results are returned from a ToolUpPDG operation. The results are in a [Result N] section of this results INI file, where N is the corresponding action number (like [Action 3])
Key |
Value |
Material |
Actual material assigned (might change for laser machines, if they don*t have any cutting condition tables for the input material) |
Thickness |
Actual thickness assigned |
Plines |
Total number of toolable plines in the drawing |
Untooled |
Number of untooled plines in the drawing |
PartialTooled |
Number of partially-tooled plines in the drawing |
UntooledLength |
Total length of untooled segments of plines |
TotalTime |
Total process time (s) |
PunchCount |
Total number of punch hits |
CutLength |
Total cutting length |
PierceCount |
Total number of pierces |
PierceTime |
Total pierce time, s |
CuttingTime |
Total cutting time, s |
PunchingTime |
Total punching time, s |
IndexingTime |
Total tool-indexing time, s |
ToolChangeTime |
Total tool change time, s |
RepoCount |
Number of repositions required |
ToolChangeCount |
Number of tool changes required |
TraverseTime |
Total time spent in rapid traverse, s |
ToolCount |
Total number of tools used |
Tool1, Tool2, Tool3, … |
Data for each tool, as a set of comma separate values. The values
are in this precise order within the CSV string: |