;;;************************************************************************** ;;; LOAD.TXT ;;; (C) 1991 by Walt Craig ;;; ;;; A part of the ;;; MAGIC LISP -- AutoLISP ADS Function Library ;;; ;;; Conceived and implemented by: ;;; Walt Craig ;;; May/June 1991 ;;; ;;;************************************************************************** ;;; Permission to use, copy, modify, and distribute this software and its ;;; documentation for the purpose of creating applications for AutoCAD, is ;;; hereby granted in accordance with the terms of the stated during ;;; installation. ;;; ;;;************************************************************************** ;;; ;;; WALT CRAIG PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. WALT CRAIG ;;; SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR ;;; FITNESS FOR A PARTICULAR USE. WALT CRAIG DOES NOT WARRANT THAT ;;; THE OPERATION OF THE PROGRAM WILL BE UNNINTERRUPTED OR ERROR FREE. ;;; ;;;************************************************************************** ;;; ;;; RESTRICTED RIGHTS LEGEND ;;; ;;; Use, duplication, or disclosure by the U.S. Government is subject ;;; to restrictions set forth in FAR 52.227-19 (Commerical Computer ;;; Software - Restricted Rights) and DFAR 252.227-7013 (c) (1) (ii) ;;; (Rights in Technical Data and Computer Software), as applicable. ;;; ;;;************************************************************************** ;;; ;;; DESCRIPTION ;;; ;;; LOAD.TXT is a sample program which illustrates the use of ;;; various MAGIC functions. ;;; ;;; This program will prompt the user for a lisp file to load. If the ;;; file is found, it is then loaded into AutoCAD via. 'load'. ;;; ;;; This program undefines the 'LOAD' command in AutoCAD. ;;; ;;; (load "loadl") ;;; load ;;; ;;;************************************************************************* ;;;* A simple text single lisp file loader ... modify it as you see fit. * ;;;***************************** Variables *************************** (defun c:load(/ file lst temp ret dbtest strings flag) (if WC_ (progn (setq dbtest (strcat "WC" "_")) (if(eval(read dbtest)) ;Is this the _debug_ version? (c:clear);This helps if your doing a lot of KIT programming ) (if(/= (WC_ ".VERSION") "I V1.5") (progn (princ "\nIncompatible KIT's"); (grread) (quit) ) ) (setvar "cmdecho" 0) (textscr) (if (/= (cadr (WC_ ".GETMODE")) 7) (WC_ ".SETCOLORS" (list _WHITE ;forward text color _BLUE ;<<--- FOR CLS ;background color _RED ;border background color _GREEN ;border text color _BLACK ;hilited text color _CYAN ;hilited background color ) )) (setq _F1 15104 _F10 17408 _ESCKEY 283 _ENTER 7181 _CANCEL 11779 _SPACE 14624 ) (WC_ ".CLS") (WC_ ".SETNUMERIC" 0) (WC_ ".SETSPEED" 50) (WC_ ".WINDOW" 10 11 65 13 1 1) (WC_ ".RELATIVE" 1) (WC_ ".DISPLAY" 1 1 "Enter file name: ") (WC_ ".TITLE" 0 " AutoLISP Pretty Load "); (WC_ ".TITLE" 1 " ENTER or SPACE "); (WC_ ".SETUPBOX" 28 12 63 12) (WC_ ".SETDENYS" (list _ENTER _ESCKEY _CANCEL _SPACE)) (WC_ ".CLEANUP"); Forces the editor to exept box not window..! (setq strings '("") flag 't) (setq lst (list "")) ;New file (while flag (setq ret(WC_ ".EDIT" lst) strings(cdr ret) ret (car ret) ) (if (or(= ret _ESCKEY)(= ret _CANCEL)) (setq flag nil) ) (if (/= (nth 0 strings) "") (setq flag nil) ) ) (WC_ ".NOCURSOR") (if (or(= ret _ENTER)(= ret _SPACE)) (progn (setq temp (nth 0 strings)) (if (not (findfile (strcat temp ".lsp"))) (progn (WC_ ".CLS") (WC_ ".MESSAGE" (strcat "File: " temp ".lsp not found!") 0) ) (progn (command(load temp)) (WC_ ".CLS") (WC_ ".MESSAGE" (strcat "The file "temp" has been reloaded.") 1) ) ) ) (WC_ ".CLS") ) (WC_ ".ONCURSOR") ) (progn (princ "\nNo KIT FOUND!"); ) ) (prin1) ) (if (not WC_) (progn (xload "_DEBUG_") (if (/= (setq str(WC_ ".VERSION")) "I V1.5") (progn (princ "\nIncompatable KIT version!"); (xunload "_DEBUG_"); ) (eval(read(WC_ ".WCINIT"))) ) ) (progn (WC_ ".message" " Type 'LOAD' to start " 0) (eval(read(WC_ ".WCINIT"))) ) ) (setvar "cmdecho" 0) (command "undefine" "load") (prin1)