So, after some finagling, I think I had this working then somehow busted the syntax somewhere. I don't exactly understand how if statements work nor how they accept results as true or not. This is my code right now:
Code:
(defun c:blockmove ()
(if(tblsearch "block" "blocka") ;if blocka exists, do this
(progn
(command "move" (ssget "X" '((0 . "INSERT")(2 . "blocka"))) 0,0,0 10,10,0)
) ; end progn
(princ "\nNothing Changed") ;else this
) ; end if
(cond ((tblsearch "block" "blockb") ; if blockb exists, do this
(command "move" (ssget "X" '((0 . "INSERT")(2. "blockb"))) 0,0,0 10,10,0)
;(princ "\nTried to move blockb")
)
((tblsearch "block" "blockc") ; if blockc exists, do this
(command "move" (ssget "X" '((0 . "INSERT")(2 . "blockc"))) 0,0,0 10,10,0)
;(princ "\nTried to move blockc")
)
((tblsearch "block" "blockd") ; if blockd exists, do this
(command "move" (ssget "X" '((0 . "INSERT")(2 . "blockd"))) 0,0,0 10,10,0)
;(princ "\nTried to move blockd")
(t
(princ "\nNo title information found; exiting!")
)
) ; end cond
(princ "Done")
(princ)
) ; end defun
blocka nearly always exists; it's existence is independent of the others (hence why is is an "IF" rather than a condition). blocks b, c and d are independent of each other; no more than one of them will exist at a time. I am sure there is a glaring error in this code, but I have built it from Google and have assuredly messed up syntax or simple logic.