By the way, unrelated to the question at hand, you can reduce the file size by eliminating a whole batch of (progn) functions, in two ways:
1. You can combine multiple variable settings in one (setq) function, so in many of your instances the one (setq) can be the 'then' argument to an (if) function, rather than a bunch of (setq)'s "wrapped" inside a (progn) function. One short example -- this:
(if (= file2 4)
(progn
(setq block12 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_bom_260")
(setq block13 "4_IN_BOM")
(setq block1 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_side_260")
(setq block14 "4_IN_SIDE")
(setq file1 nil)
)
)
can be done this way:
(if (= file2 4)
(setq
block12 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_bom_260" ;; note right parentheses removed
block13 "4_IN_BOM"
block1 "C:/Block Viewer2/Ferrule Tank Kettle Valve NZ-FER-001/4_in_side_260"
block14 "4_IN_SIDE"
file1 nil
); setq ;; this right parenthesis covers all variable settings
); if
2. In a "satisfied" condition in a (cond) function, you don't need to "wrap" multiple functions inside a (progn) function, the way you do for the 'then' or 'else' argument to an (if) function [even if you were to keep separate (setq) functions as in most of your (cond)/(progn) functions]. You can change this [a shorter example]:
((= file3 2)
(progn
(setq block12 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_bom_330")
(setq block13 "LUG_BOM")
(setq block1 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_side_330")
(setq block14 "LUG_SIDE")
(setq block2 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_top_330")
(setq block15 "LUG_TOP")
(setq file4 nil)
); progn
); file3 = 2 condition
to this:
((= file3 2)
(setq
block12 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_bom_330"
block13 "LUG_BOM"
block1 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_side_330"
block14 "LUG_SIDE"
block2 "C:/Block Viewer2/Lifting Lugs/Lifting lug silo SI-LLG-001/lug_top_330"
block15 "LUG_TOP"
file4 nil
); setq
); file3 = 2 condition
Kent Cooper, AIA