Nice tutorial in post #3 mr.Puckett !
I remember once you posted a code with the following structure:
(defun C:test ( / subfun1 subfun2 err )
(defun subfun1 ( n / o ) ; arg expects valid layer name
(setq o (vla-item (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) n))
)
(defun subfun2 ( s o ) ; arg expects ":vlax-true" or ":vlax-false" string, and layer vla-object
(vla-put-Lock o (read s))
)
(cond
( (not subfun1)
(alert "\nSubfunction #1 not defined.")
)
( (not subfun2)
(alert "\nSubfunction #2 not defined.")
)
( (vl-catch-all-error-p (setq err (vl-catch-all-apply 'subfun1 (list (getstring "\nSpecify layer name: ")))))
(alert (strcat "\nError occured in subfun1: " (vl-catch-all-error-message err)))
)
( (vl-catch-all-error-p (setq err (vl-catch-all-apply 'subfun2 (list (getstring "\nSpecify lock status: ") err))))
(alert (strcat "\nError occured in subfun2: " (vl-catch-all-error-message err)))
)
(T
(alert "\nEverything is being successful.")
)
); cond
(princ)
); defun C:test
So I use the above as a pseudo-template, related to a problem I posted here (theswamp), the "Questions for the experienced programmers" thread.
Where the main issue was how to handle a super-long code without getting lost.
However instead of
"divide and conquer strategy" I prefer to name this as
"create an assembly" (the same way Autodesk Inventor works) - ofcourse thats individual preference.