Command Line Comparison Tool
CADMATIC Hull includes a command line tool for comparing two Hull models, or all drawings in two Hull projects: moddiff (moddiff.exe). When comparing projects, the tool can optionally compare two block groups or two blocks only instead of the entire projects.
The moddiff tool can be run independently of Hull in the Windows Command Prompt window, or in the Hull Command Window (see Command Window).
The moddiff tool relies on the same compare functionality as the Compare tool, which is available in the 3D-Contek and Shell applications, Tools > Tools > More Tools > Compare.
The return value of the moddiff executable is available through the %errorlevel% environment variable. It will hold the amount of differences that were found. If %errorlevel% is 0 after the comparison, the selected drawings are identical. This can be utilized in batch processing. See Batch Processing.
The executable is located in the Hull installation folder, subfolder \nupashull\windowsNT\ncgbin. For example C:\cadmatic\CH201\nupashull\windowsNT\ncgbin.
Comparing Models
When comparing Hull models, use the following syntax:
moddiff <model1> <model2> [/o:<result>] [/i:<item filter>]
<model1> and <model2> are the two drawing files to be compared.
The following two arguments are optional:
/o:<result> – Where <result> is the name of the output file containing the comparison result. The file is a Hull model file (.mod). If the output file is not defined, a moddiff.mod result file is created in the active folder.
/i:<item filter> – Where <item filter> defines the types of items in the models that are considered in the comparison, and thus included in the results. This is an integer, and must be either one the following, or a sum of all or some of them:
- 1 polygons
- 2 arcs
- 4 sub-models
- 8 faces
- 16 texts
- 32 dimensions
The default value is 63 (1+2+4+8+16+32), meaning that all item types are considered in the comparison.
Example:
moddiff c:\models\modelA.mod c:\models\modelB.mod /o: c:\temp\comparedAB.mod /i:59
In this example, all items except sub-models are included in the comparison (59=63-4) of modelA.mod and modelB.mod.
The output model file contains the differences between the two compared models.
The items in the model can be in four different fragments (layers), as follows:
- 200 – item is from model 2, not present in model 1
- 201 – item is from model 1, not present in model 2
- 202 – item is from model 2; present in both models, but different
- 203 – item is from model 1; present in both models, but different
Those items that are present in both models, and identical, are not included in the result.
Comparing Projects
When comparing Hull projects, multiple drawings in the projects are compared.
Use the following syntax:
moddiff <project1> <project2> [/g:<block group>] [/b:<block>]
<project1> and <project2> are paths to the project folders to be compared.
The following two arguments are optional:
/g:<block group> – Only compare drawings in a specified block group. <block group> is the name of the block group. All blocks in the block group are included in the comparison, so it is not necessary to further specify any blocks when this argument is used.
/b:<block> – Only compare the drawings in a specified block. <block> is the block name.
Example:
moddiff c:\projects\projectA c:\projects\projectB /g:Hull /b:234
In this example, block 234 in the Hull block group in projectA and projectB is compared.
The results are shown either in the Windows Command Prompt window or the Hull Command Window, depending on where the executable was run from.
The result lists all the drawings in the projects or block groups block by block, or the drawings in the compared single blocks. The result shows the number of differences found in each drawing (if any), and the total number of differences found.
If a drawing, block, or block group is present in one project and not in the other, that is also shown as a difference in the result.
The image below shows an example of a partial result of a comparison of two whole projects run from the Windows Command Prompt.
The moddiff executable returns the %errorlevel% value, which can be utilized when writing batch files. For example:
@echo off
moddiff %1 %2
set diffcount=%errorlevel%
if diffcount==0 echo Projects are equal
if diffcount gtr 0 echo Differences detected!