Swap Patterns (CID) or ITM’s in CAMduct, ESTmep & CADmep
Did you know you can change the Pattern (CID) of an Items in your Takeoff or Drawing in Fabrication? A Simple COD script is all it takes. Obviously, you an do some irrational things like try to change a piece of Decoiled Straight (Pattern #866) to a Square Elbow (Pattern #3). But there’s plenty of cases where swapping ITM’s and Patterns makes a lot of sense.
You may want to take a piece of Machine Cut Straight (Pattern #1) and change it to Decoiled (Pattern #35) or Sheared (Pattern #36) or the universal Straight (Pattern #866).
You may even want to keep the same pattern number and merely load a new ITM to get dfferent options like going from a Gored to Adjustable Elbow based on your library. The possibilities are really endless.
Credit for this technique goes to Christopher Kelly (https://www.linkedin.com/in/kelleychristopher/) of Infinate CAD Solutions (https://infinitecad.com/) in Riverdale, Utah.

How It Works
The script itself is fairly simple if you know COD scripting. The Steps are as follows…
- Define the Path of the ITM file you want to Swap In.
- Define Restrictions on what ITM’s in your DWG/MAJ to apply to.
- Save Values you want to carry over.
- Load new ITM definition from Disk.
- Save Carry Over values to updated ITM definition.
- Update/Save Changes to ITM
REM - STEP 1
REM - Define Replacement ITM
dim itmName = MAPPATH_ITEMS + "\Imperial Content\CID866.itm"
REM - STEP 2
REM - If Item Matches Target You Want To Swap...
if item.PatNo = 1 Then
REM - STEP 3
REM - Save Values to Bring to New ITM
dim saveAlias = item.Alias
dim saveBoughtOut = item.BoughtOut
dim saveDim1 = item.dim[1].Value
dim saveDim2 = item.dim[2].Value
dim saveDim3 = item.dim[3].Value
dim saveDrawing = item.Drawing
dim saveETag = item.ETag
dim saveInsSpec = item.InsSpec
if Upper(saveInsSpec) = "NOT SET" then saveInsSpec = ""
dim saveISpecLock = item.ISpecLock
dim saveNotes = item.Notes
dim saveNumber = item.Number
dim saveOrder = item.Order
dim saveQty = item.Qty
dim saveService = item.Service
dim saveSpecification = item.Specification
dim saveSpecLock = item.SpecLock
dim saveSpool = item.Spool
dim saveStatus = item.Status
dim saveZone = item.Zone
REM - STEP 4
REM - If Loading New ITM Successful...
if item.Load(itmName) Then
REM - STEP 5
REM - Restore SAves Values
item.Alias = saveAlias
item.BoughtOut = saveBoughtOut
item.Dim[1].Value = saveDim1
item.Dim[2].Value = saveDim2
item.Dim[3].Value = saveDim3
item.Drawing = saveDrawing
item.ETag = saveETag
item.InsSpec = saveInsSpec
item.ISpecLock = saveISpecLock
item.Notes = saveNotes
item.Number = saveNumber
item.Order = saveOrder
item.Qty = saveQty
item.Service = saveService
item.Specification = saveSpecification
item.SpecLock = saveSpecLock
item.Spool = saveSpool
item.Status = saveStatus
item.Zone = saveZone
REM - STEP 6
REM - Updagte ITM and Save to Memory
item.Update ()
item.RefreshCosts ()
else
Debug "Error: Swap Failed. Unable to Load Replacement ITM."
end if
end if