Quick Karl Posted April 24, 2012 Share Posted April 24, 2012 (edited) Ok this is going to be tricky First, the only thing I know about LISP and VLISP, is that when they work, they’re great! In 2004 a friend wrote a group of lisp routines that I rely on heavily, and although I was somehow able to get them to work on my new ACAD2012 Win7 64-bit computer, I can NOT, for the life of me, figure out what I did to get them to work. It had something to do with adding _$ (vl-load-com) somewhere, and then suddenly everything worked, but I haven’t a fricken clue what I did or where I did it. There IS a vlx folder in the directory where all this stuff is installed, and it has vlx stuff in it. Having experienced an annoying memory glitch I just had to reload everything on my computer and, I have the menus loaded (menuload), and can see the toolbars that are part of the lisp tools, and even one of them actually works (changes the drawing scale (and dim scale concurrently) and LT scale to what I like from a list), but other tools like a dimension tool that automatically places dimensions on the DIM layer and at the proper dimscale for the drawingscale, regardless of what layer is current, and all the other tools, just report something like this: Command: (setq DIMCMND "_dimlinear")"_dimlinear" Command: dimlyr undo Current settings: Auto = On, Control = All, Combine = No, Layer = No Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: begin Command: bad argument type: FILE nil Like I said, I did something with a _$ (vl-load-com) somewhere that made all of these tools work, but I am getting old and just can’t remember what the * I did. If anyone can help I can’t begin to tell you how thankful Iwould be. It worked only a week ago before I had to reinstall everything, and I am miffed... Thank you Edited April 24, 2012 by Quick Karl Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 24, 2012 Share Posted April 24, 2012 Just create a text file named acaddoc.lsp in your profile's Support folder (check in Properties -> Files --> Support File Search Path) and paste the line below in that file. This will ensure that VisualLISP extension is loaded in every drawing. (vl-load-com) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 24, 2012 Share Posted April 24, 2012 Try to create acaddoc.lsp file and place it in AutoCAD Support folder... Inside acaddoc.lsp add line (vl-load-com), and whenever you start CAD (vl-load-com) will be automatically loaded into memory... This is probably the reason why programmers of routines have omitted (vl-load-com) line within their codes - they simply had that function reactors for making operational all vla- VisualLisp AciveX COM+ functions loaded in the start so they don't concentrate of making functions operational, but they just write them like they are built-in AutoLisp Vanilla API... Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 24, 2012 Author Share Posted April 24, 2012 I've tried that in both the acad2012doc.lsp AND the acad2012.lsp files (they are the only files like this I could find on my system) - and I have the correct support file path - but still the same error... should I NOT be using these '2012' version of this file (should I just create a acaddoc.lsp file)?? Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 24, 2012 Share Posted April 24, 2012 Please do not modify those file - are reserved for AutoCAD. Create your user auto-loader as instructed above. If you don't have an acaddoc.lsp file on your system, then create a new one using Notepad; if there is one then open it and append at the end. If by doing so your tools still not work, then you should revise their installation/setup procedure. Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 24, 2012 Author Share Posted April 24, 2012 Please do not modify those file - are reserved for AutoCAD. Create your user auto-loader as instructed above. If you don't have an acaddoc.lsp file on your system, then create a new one using Notepad; if there is one then open it and append at the end. If by doing so your tools still not work, then you should revise their installation/setup procedure. No idea what you mean revise installation/setup procedure... I restored the original 2012 files and created the new file with only (vl-load-com) and saved it to the profile's support location - still the same error I could swear that the first time I had to go through this I used this exactly _$ (vl-load-com) including the underscore and dollar sign, but I wish I could remember what the heck I did??? Would that be something inside a lisp program??? Should I add the _$ in front of (vl-load-com) in my new acaddoc.lsp? I guess I should have been smart and wrote down that the heck I did -- I hate working wothout these lisp tools :-( Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 24, 2012 Share Posted April 24, 2012 The "_$" is the prompter of VisualLISP editor console; I'm not aware to be used somewhere else. You can load there the VL extension and will look like you wrote it, but then will have to do so in each and every drawing. By "installation/setup procedure" I mean the exact procedure you should follow to get the said tools pack installed in your AutoCAD. It doesn't come with a written document describing the step-by-step setup? Can you contact the developer? Maybe you are missing a setup step - for example to add a folder to Support File Search Path list (from the error you posted above seems that a routine isn't able to locate a file). Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 24, 2012 Author Share Posted April 24, 2012 The person that wrote these isn't around anymore, and he was very hard to work with. I've installed this many times, it still works perfect on a 32bit laptop with XP Pro on it -- I actually had it working on this 64bit Win 7 computer before I had to reload everything. I was searching all over the internet for vl-load-something and somehow I got it to work but not this time... pain in my butt I swear. Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 24, 2012 Share Posted April 24, 2012 Please try to paste the line below on AutoCAD's command prompt and press . If will print "Is loaded!" then the VL extension is available. Other will get and error message (; error: no function definition: VL-STRING-SUBST). (vl-string-subst "loaded" "*" "Is *!") Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 24, 2012 Share Posted April 24, 2012 Hi Quick Karl, To clarify a few things from my perspective: 1. Loading the Visual LISP Functions Before you can use any functions with the prefix: vla-* / vlr-* / vlax-* you will need to load the Visual LISP Module; this module only needs to be loaded once per session. To ensure the Visual LISP module is loaded , create a file in an AutoCAD Support Path called ACADDOC.lsp (notACAD2012DOC.lsp or ACAD2012.lsp, as these are reserved for use by the application and will be overwritten if you upgrade or update the software). Before creating this file, first search your AutoCAD Support Paths to ensure that the file doesn't already exist. If the file already exists, in the following steps, modify the existing file. If the file doesn't already exist, open Notepad and type the following: (vl-load-com) Now save this file as ACADDOC.lsp (with the 'Save As Type' box set to 'All Files'). Note: you only need to type (vl-load-com) not _$ (vl-load-com). The "_$" is the Visual LISP IDE Console Prompt. 2. Your Applications From the message you are reporting: Command: (setq DIMCMND "_dimlinear")"_dimlinear" Command: dimlyr undo Current settings: Auto = On, Control = All, Combine = No, Layer = No Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: begin Command: bad argument type: FILE nil It would appear that your programs rely heavily on calling AutoCAD commands. This can be an unreliable approach, since the prompt order, behaviour and available options for many AutoCAD commands will vary across versions, resulting in many applications working in one version, but not another. The error: bad argument type: FILE nil would indicate that the program is supplying a function which requires a file descriptor parameter (such as write-line / write-char / princ / print / prin1) a null argument. However, this is almost impossible to debug without the ability the view the program source code. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 24, 2012 Share Posted April 24, 2012 Quick Karl, Please read the CODE POSTING GUIDELINES and edit your posts. Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 24, 2012 Author Share Posted April 24, 2012 (edited) Thanks Lee, I've used a previous suggestion and the (vl-load-com) does, in fact, load - so that isn't the problem - so much for thinking it was... I cannot answer any code questions, all I know is that I had to do circus acrobat contortions to get the tools written the way I wanted them, and the person that wrote these was extremely stubborn. These tools were actually created as a 'Partnership" between myself and the coder – we named them TKUtilities (the letter T for the coder (Terry) and the letter K, for me, Karl). With that partnership I had to resign myself to the inclusion of some tools that no one ever used, but the code guy thought were cool. At the time, I found quite a few customers to purchase the tool set and I didn't take one penny from any sale ever -- gave all the money to Terry. I just wanted a good set of convenience tools... So much for being a nice guy. I no longer use AutoCAD enough to justify learning to code these myself, or to justify going through the stubborn-child-coder thing again,much less pay for it; but I surely do wish I could get these working. My next best guess is it might have something to do with the UAC in Win 7, pain in the butt that it is... I guess I am going to have to draft slow on the rare occasions that I draft anymore. Thanks for your help. LASTLY - this is THE most WHACKED comment editor I have ever used, on any forum, anywhere, ever. Edited April 24, 2012 by Quick Karl Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 26, 2012 Author Share Posted April 26, 2012 This HAS to be a 32bit / 64bit problem... I just reloaded all of these utilities on a 32bit Win XP Pro SP3 laptop, and they work flawlessly.... What am I missing on my 64bit Win7 Pro? A few tools are working, but some, of course a few I use the most, still aren't. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 26, 2012 Author Share Posted April 26, 2012 OK, How do I tell you folks that the FIRST instance of (read-line FIL) in the program below, is where this stops working (this editor will not let me highlight it)... Then - REMEMBER I am NOT a lisp guy - what do I look for to try to figure out why it is stopping at this point? (defun c:LyrList (/ FIL LYRFILE LYRATTS LISTNAM LISTCLR LISTLWT LISTLIN LISTDES CMD NDXNAM NDXCLR NDXLWT NDXLIN NDXDES FLAG FH IMGX DIVMM IMGY LYRLST LYRSELECTION INDEX NEWLYRLWT INDXNO LYRINFO CLYR ) (setvar "cmdecho" 0) (command ".undo" "be") (setq VERSION "Standard Layer List V2.0") ;version displayed in dialog (if (= (getvar "lwunits") 0) ;if lineweights in inches (setq DIVMM 25.4) ;divide by mm ) (if (not read_ini) (load (strcat PATHLISP "IniRead")) ;load ini read function ) (read_ini "Layer List" (findfile INI_FILE)) ;get layer list name (setq LYRFILE R_INI_VALUE) (if (not delimit_to_list) (load (strcat PATHLISP "delimit_to_list")) ;load delimit function ) (setq FIL (open LYRFILE "r")) ;read layer list file (read-line FIL) ;skip header line of layer list (while (setq LYRATTS (read-line FIL)) ;make lists of... (setq LYRATTS (delimit_to_list "," LYRATTS)) (if LISTNAM ;...layer names... (setq LISTNAM (append LISTNAM (list (cdr (assoc 1 LYRATTS))))) (setq LISTNAM (list (cdr (assoc 1 LYRATTS)))) ) (if LISTDES ;...layer descriptions. (setq LISTDES (append LISTDES (list (cdr (assoc 2 LYRATTS))))) (setq LISTDES (list (cdr (assoc 2 LYRATTS)))) ) (if LISTCLR ;...layer colors... (setq LISTCLR (append LISTCLR (list (cdr (assoc 3 LYRATTS))))) (setq LISTCLR (list (cdr (assoc 3 LYRATTS)))) ) (if LISTLIN ;...layer linetypes... (setq LISTLIN (append LISTLIN (list (cdr (assoc 4 LYRATTS))))) (setq LISTLIN (list (cdr (assoc 4 LYRATTS)))) ) (if LISTLWT ;...layer lineweights... (setq LISTLWT (append LISTLWT (list (cdr (assoc 5 LYRATTS))))) (setq LISTLWT (list (cdr (assoc 5 LYRATTS)))) ) ) (close FIL) ;;;sub-function to get layer attributes from lists (defun getlayeratts (/) (setq LYRSELECTION (read (strcat "(" (get_tile "lnam") ")"))) ;get selected layers (if (> (length LYRSELECTION) 1) ;if more than one layer selected (progn (setq imgx (dimx_tile "lclrimg") ;clear layer color imgy (dimy_tile "lclrimg") ) (start_image "lclrimg") (fill_image 0 0 imgx imgy -15) (end_image) (set_tile "ldestxt" "") ;clear layer description (set_tile "lclrtxt" "") ;clear layer name (set_tile "llintxt" "") ;clear layer linetype (set_tile "llwttxt" "") ;clear layer lineweight );progn (progn ;if only one layer selected (setq INDEX (atoi $value) ;get selected layer NDXNAM (nth INDEX LISTNAM) ;get layer name NDXDES (nth INDEX LISTDES) ;get layer description NDXCLR (nth INDEX LISTCLR) ;get color NDXLIN (nth INDEX LISTLIN) ;get linetype ) (if DIVMM ;if lweights in inches (setq NDXLWT (strcat (rtos (/ (atof (nth INDEX LISTLWT)) DIVMM) 2 3) " in.")) ;convert to inches (setq NDXLWT (strcat (nth INDEX LISTLWT) " m.m.")) ;or leave in mm ) (set_tile "ldestxt" NDXDES) ;description (set_tile "lclrtxt" (strcat "No. " NDXCLR)) ;display color number (setq imgx (dimx_tile "lclrimg") ;display color image imgy (dimy_tile "lclrimg") ) (start_image "lclrimg") (fill_image 0 0 imgx imgy -15) (fill_image 0 -3 imgx imgy (atoi NDXCLR)) (end_image) (set_tile "llintxt" NDXLIN) ;display linetype (set_tile "llwttxt" NDXLWT) ;display lineweight );progn );if );getlayeratts (setq FLAG 2) (while (< 1 FLAG) (setq FH (load_dialog (strcat PATHDCL "LayerList.dcl"))) (if (not (new_dialog "layer" FH)) (exit) ) (start_list "lnam" 3) (mapcar 'add_list LISTNAM) (end_list) (setq imgx (dimx_tile "lclrimg") ;on open, set color to background imgy (dimy_tile "lclrimg") ) (start_image "lclrimg") (fill_image 0 0 imgx imgy -15) (end_image) (set_tile "lver" VERSION) (if CURR ;set layer current toggle (set_tile "curr" CURR) ) (action_tile "lnam" "(getlayeratts)") (action_tile "curr" "(setq CURR $value)") (setq FLAG (start_dialog)) );close while (unload_dialog FH) (if (= FLAG 1) (progn (if LYRSELECTION ;if layers selected (foreach LYRINDX LYRSELECTION ;for each selected layer (setq INDXNO (rtos LYRINDX 2 0) ;get list number LYRINFO (list (nth LYRINDX LISTNAM) ;get layer name (nth LYRINDX LISTCLR) ;get layer color (nth LYRINDX LISTLIN) ;get layer linetype (nth LYRINDX LISTLWT) ;get layer lineweight ) ) (setq LYRLST (append (list LYRINFO) LYRLST)) ;add above to list ) ) (if LYRLST ;if new layer list, make layers (progn (setq CLYR (getvar "clayer") ;get current layer CMD (getvar "cmdecho") ) (setvar "cmdecho" 0) (foreach NEWLYR LYRLST ;make each selected layer (if DIVMM ;if lweights in inches (setq NEWLYRLWT (rtos (/ (atof (nth 3 NEWLYR)) DIVMM) 2 3)) ;convert to inches (setq NEWLYRLWT (nth 3 NEWLYR)) ;or leave in mm ) (command ".layer" "m" (nth 0 NEWLYR) "c" (nth 1 NEWLYR) "" "lt" (nth 2 NEWLYR) "" "lw" NEWLYRLWT "" "" ) ) (setvar "cmdecho" CMD) (if (or (null CURR)(= CURR "0")) ;if user doesn't want layer current (setvar "clayer" CLYR) ;set back to previous layer ) );progn );if );progn );if (command ".undo" "e") (princ) );close LyrList Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 26, 2012 Share Posted April 26, 2012 The routine is attempting to read a file stored in R_INI_VALUE - just write the line below on AutoCAD's command prompt and see what it returns. Should be a path; please check to be available on your station. !R_INI_VALUE By the way, you can highlight a line in a code excerpt by changing his color. Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 26, 2012 Author Share Posted April 26, 2012 I did as you said and it returned the proper values "ARIAL,Arial,0.25000,1.0,TEXTT,1"... I don't understand why the program stops there in the VLIDE window?? Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 26, 2012 Share Posted April 26, 2012 That variable is supposed to hold the path of a file: (read_ini "Layer List" (findfile INI_FILE)) ;get layer list name (setq [color=blue]LYRFILE[/color] [color=magenta]R_INI_VALUE[/color]) ... (setq FIL (open [color=blue]LYRFILE[/color] "r")) ;read layer list file Try to do a search in your files for the string below to see what is followed by: (setq R_INI_VALUE Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 26, 2012 Share Posted April 26, 2012 Alternatively, add the lines below (in red) to the above said file, run the trouble-maker routine again and press F2 after it crash to see the debug report. (read_ini "Layer List" (findfile INI_FILE)) ;get layer list name (setq LYRFILE R_INI_VALUE) [color=red](print "\n********************** DEBUG **********************\n") (print (list R_INI_VALUE (findfile R_INI_VALUE)) (print "\n********************** DEBUG **********************\n")[/color] (if (not delimit_to_list) (load (strcat PATHLISP "delimit_to_list")) ;load delimit function ) (setq FIL (open LYRFILE "r")) ;read layer list file The debug report should be in the form of: (“Drive:\\Folder\\SubFolder\\File” “Drive:\\Folder\\SubFolder\\File”) If second item in list is nil, then you should add the path to Support File Search Path list. Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 26, 2012 Author Share Posted April 26, 2012 I will see if I can stumble my way through this -- but I am completely NOT a coder. The whack thing is, all of these programs were working perfectly on this very same computer only 1-week ago, but I had to reinstall everything after a memory glitch had corrupted a few programs, and now I can't figure out what to do. Quote Link to comment Share on other sites More sharing options...
Quick Karl Posted April 27, 2012 Author Share Posted April 27, 2012 Not even the slightest idea how to get this to work -- paste your code into mine and the thing locks up completely Alternatively, add the lines below (in red) to the above said file, run the trouble-maker routine again and press F2 after it crash to see the debug report. (read_ini "Layer List" (findfile INI_FILE)) ;get layer list name (setq LYRFILE R_INI_VALUE) [color=red](print "\n********************** DEBUG **********************\n") (print (list R_INI_VALUE (findfile R_INI_VALUE)) (print "\n********************** DEBUG **********************\n")[/color] (if (not delimit_to_list) (load (strcat PATHLISP "delimit_to_list")) ;load delimit function ) (setq FIL (open LYRFILE "r")) ;read layer list file The debug report should be in the form of: If second item in list is nil, then you should add the path to Support File Search Path list. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.